Hello,
I am trying to create a loop for a large cross-sectional dataset that identifies string variables with the response options "Yes; No; or, Unknown", replaces these values with "1, 0, or, -1", and destrings them. Preferably I would like to replace the original string variable rather than generate duplicate numeric variables. Do I have to go through the entire dataset and identify each variable name to add to a local varlist or can I set a conditional statement and loop over all the variables?
Thank you,
Tom
Related Posts with foreach loop based on whether variable has certain values
SSC install failureI got a new device and had to reinstall Stata, now having problem installing rangestat and rangerun.…
META-ANALYSIS without standard-deviationsI am trying to perform a meta-analysis estimation with data from studies using different methodologi…
How to store multiple regression resultsHello, I am currently running a Vector autoregression with 5 lags and 4 exogenous variables. I have …
Time series operators to find optimal lag in a regressionI am doing a study correlating stock market (S&P 500) valuations to future annual market returns…
How to sample with unequal probability in a given populationHi Statalist experts, Suppose I have data on a population of N subjects, each has X1-X5 and and var…
Subscribe to:
Post Comments (Atom)
0 Response to foreach loop based on whether variable has certain values
Post a Comment