I just want to compute descriptive statistics of the categorical time-invariant variables in the attached longitudinal data file.
For the sake of efficiency, I used the following for-loop code to compute them.
However, something is wrong and I couldn't find what places are incorrect.
Thanks for your suggestions and help!
use data.dta,clear
local a male esl_pgm bil_pgm everspec hispanic
foreach var of a {
preserve
bys id: keep if _n==1
sum `var'
restore
}
Related Posts with Why is My Stata for-loop Code Wrong?
Intergenerational Income Mobility analysis - Matching child information to parents across rowsHi, I am using Stata 16 and carrying out analysis on intergenerational income mobility, using the U…
Error with -fre- (SSC) when using strings with Chinese (traditional) textWhen using -fre- from Ben Jann (on SSC) with string variables containing Chinese (traditional) text,…
Destring-Ignore-Backtick Command with "Too Few Quotes" ErrorHi Everyone. Started using Stata a few weeks ago and now I am addicted! I am currently trying run th…
Replace missing values in group dataHi everyone, Was looking for a solution to the following problem. I have a panel data that has som…
Logistic Additive Model, dfHow to include df in logistic model and generate graph like below with different degress of greedom?…
Subscribe to:
Post Comments (Atom)
0 Response to Why is My Stata for-loop Code Wrong?
Post a Comment