Hi everyone,
I'm fairly new to STATA and this one practice problem has been driving me crazy...I would really appreciate any help...
I'm trying to create a local variable that lists only the “long name variables of more than 8 characters in a dataset
So far I have
foreach var of varlist *{
display "`var'"
if length("'var'")>8 {
}
}
Which generates an error message. I've tried several other configurations but none has worked. Any guidance would really be appreciated!
Related Posts with Using if statements using foreach
comparing data when one observation is recorded more than onceSorry about the barrage of questions but I am struggling with this. I have a file which look like th…
Compare variable in two stata files and listI have two datasets and I want to make sure that the same IDnumber has not been recorded twice in th…
Compatibility of Stata 16 and Stata 17 outputs?At my academic workplace I have Stata 16 MP (16.0, not updated -- long story, endless fights with th…
Remove estimated parameters from Stata result windowHi All, just a quick question. I am estimating a model containing a lot of dummies, which I use as …
REGHDFE Coefplot graphing mistakeI'm having a little trouble graphing coefplot. My regression is using reghdfe command and I'm simply…
Subscribe to:
Post Comments (Atom)
0 Response to Using if statements using foreach
Post a Comment