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
Running out of memory while merging .dtaDear all, I am encountering a problem similar to this post (running out of memory while merging). In…
Test statistics from multinomial logit regression using esttabPlease I would like to perform joint tests of significance in a multinomial logit and include the re…
Conditionally Replacing Values in Long-Data Format Dataset?Hello, I have simplified an original question I had so that it is much more approachable. I have lo…
Advice on how to compute generalized residuals for order probit with panel dataHello, I am using a control function approach to correct for an endogenous ordinal variable (with t…
Allignement of Histogram BarsHow can I change the alignment of the bars in a histogram without changing the x variable. The bars …
Subscribe to:
Post Comments (Atom)
0 Response to foreach loop based on whether variable has certain values
Post a Comment