Hello,
I have one of the variables G1 which has values from 1 to 17.
Then I want to make a loop as below,but it didn't work out.
Anyone can help what is the problem? thanks in advance.
foreach i in G1 {
sum sw20h if G1==`i'
global Ng`i'=r(sum)
}
Related Posts with making loop with the values within the variable
How to reduce the size of large data files in Stata? Hi, I am working on high-frequency datasets. One-month Stata data file comes to around 4 GB (4 mil…
Multilevel Ordered Logistic Regression (meologit)Dear Statalist, I have data on individual outcomes where the individual is a member of a subgroup (…
How to analyze Manipulation Check question in stata?Hi! I would like some advice on how to analyze a manipulation check regarding the effect size (cohe…
How to realize the functions like (gen sum) and (egen sum) for string variables by group?In the sample data, B is what I want to get from A (something like egen sum). I also want to genarat…
How to simply add and divide?Dear Statalist users, I want to calculate a ratio by simply adding two variables, and then dividing…
Subscribe to:
Post Comments (Atom)
0 Response to making loop with the values within the variable
Post a Comment