Do-fayl β Stata buyruqlarini saqlovchi skript fayl.
Do-fayl yaratish
Stata > Do-file Editor > New Do-file (Ctrl+9)
Do-fayl tuzilishi
/* ============================================
Loyiha: Daromad tahlili
Muallif: Sherali
Sana: 2024-01-15
============================================ */
* Sozlamalar
clear all
set more off
version 17
* Global o'zgaruvchilar
global data "C:/loyiha/data"
global natija "C:/loyiha/natija"
* ---- 1. MA'LUMOT YUKLASH ----
use "/asosiy.dta", clear
describe
* ---- 2. TOZALASH ----
drop if daromad < 0
replace yosh = . if yosh > 120
* ---- 3. TAHLIL ----
summarize daromad yosh ta_lim
regress daromad ta_lim yosh i.jinsi
estimates store model1
* ---- 4. SAQLASH ----
log using "/tahlil.log", replace text
esttab model1 using "/jadval.rtf", ///
replace b(3) se(3) r2 ///
title("1-jadval: OLS natijalari")
log close
Shartli buyruqlar
if _rc == 0 {
display "Muvaffaqiyatli"
} else {
display "Xato yuz berdi"
}
Tsikl (foreach)
foreach var of varlist daromad yosh ta_lim {
summarize `var'
histogram `var', saving(`var', replace)
}
* Ro'yxat bo'yicha
foreach shahar in Toshkent Samarkand Buxoro {
display "Shahar: `shahar'"
}