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?
Grouping datesHello I have a dataset with lots of repeated measures and dates. I currently have this in the long …
Event study modellingDear forum members, I am currently working on the capital market consequences of a specific regulat…
Need help in probit model: probability that a developing country which is a WTO member faces a dispute.Hello! Hope you are all having a great week! I need help to calculate the probability that a devel…
Data cleaningHi members, i am new around here and a novice with research. i am trying to conduct an Interrupted …
-vecrank- errorHey, I have a monthly time series data from 2005m1 to 2018m12. On visual inspection there are no gap…
Subscribe to:
Post Comments (Atom)
0 Response to Why is My Stata for-loop Code Wrong?
Post a Comment