Hi everyone,
I am trying to run the following code:
count if productcode == 21
scalar nobs = r(N)
local n nobs
forvalues b = 1(1)`n' {
display `b'
}
However, I get invalid syntax error. Can anyone help me on this issue? Thanks in advance.
Best,
Ulas
Related Posts with Using local variable in forvalues loop
Average of a variable using xtsumHi I am new to the panel variables and have encountered a problem. I am using xtsum command to get t…
Conducting Principal Component Analysis on STATAHello everyone. I'm trying to create a wealth index on STATA using principal component analysis, and…
Categorising consecutivelyI am trying to generate a new variable which consecutively categorises an existing category. I am no…
Block regressions using foreach loop on global macrosHello Listers! I am trying to run multiple block regressions. I have put a set of explanatory varia…
Gini indexHello How do I calculate the Gini coefficient with the equivalent scale method in stata ? Please ex…
Subscribe to:
Post Comments (Atom)
0 Response to Using local variable in forvalues loop
Post a Comment