Hello,
I'm not that experienced with stata yet. I tried to visualize the distributions of the variables after each sample restriction. Now I would like to export these tables to excel after each loop, how could I incorporate this into the loop.
local conditions "age>=18 age<=82 weight>0 height>0 newbaby==2 !missing(Jahreseinkommen) !missing(weight) !missing(height)"
local commands "tabstat Jahreseinkommen BMI height weight $numerisch Geschlecht* Bildungsniveau* Wirtschaftsregion* Gesundheit* ChronischKrank* Raucher* , statistics(mean sd min max count p99 p1) missing columns(statistics)"
foreach condition in `conditions' {
keep if `condition'
`commands'
tab year
count
}
I'm not that experienced with stata yet. I tried to visualize the distributions of the variables after each sample restriction. Now I would like to export these tables to excel after each loop, how could I incorporate this into the loop.
local conditions "age>=18 age<=82 weight>0 height>0 newbaby==2 !missing(Jahreseinkommen) !missing(weight) !missing(height)"
local commands "tabstat Jahreseinkommen BMI height weight $numerisch Geschlecht* Bildungsniveau* Wirtschaftsregion* Gesundheit* ChronischKrank* Raucher* , statistics(mean sd min max count p99 p1) missing columns(statistics)"
foreach condition in `conditions' {
keep if `condition'
`commands'
tab year
count
}