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
P value and 95%CI don't matchHello. I could like to calculate the risk difference between two groups for an outcome, using the C…
Hurdel model with interval dataHi Does anyone know how to run a hurdle model with interval data? We have asked the respondents abo…
Regression and putexcel with parenthesesHi, I'm pretty sure I'm not the first one asking this but after a couple of hours I couldn't figure …
Process for LCA in StataI'm trying to do an LCA for the first time. I have read the Stata manual, various papers about LCA, …
Interpolate to end of month instead of mid month data?Hello, all my data are for the end of month. But I have one variable where the data is listed mid mo…
Subscribe to:
Post Comments (Atom)
0 Response to Using if statements using foreach
Post a Comment