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?
Trimmed MeanHi Stata Community, I hope you are all doing well. I am afraid I have a question regarding the calc…
comparing two linear regression linesI am comparing the glomerular filtration rate (continuous) measured by creatinine clearance (gold st…
Deleting number of observations below 3 in histogram?Hi, How can I delete the bars in the histogram if there is less or equal to 3 observations? The his…
Strange error of function usubinstr???Hi! I want to use the function usubinstr() to replace unicode substring "我爱" in Unicode string varia…
Percentage of a variable depending on different income binsI'm trying to find out depending on the variation of income what percentage of a particular income b…
Subscribe to:
Post Comments (Atom)
0 Response to Why is My Stata for-loop Code Wrong?
Post a Comment