Hi everyone,
Using the below codes, I am trying to generate a new variable (long_X6 to long_X13) and replace its values by the values of the preceding variable or X5 to X12 (coded as `var'-1==2). I do not get any errors when run this code but nothing happens in the data.
Thanks,
Nader
foreach var of varlist X6-X13 {
replace long_`var'=2 if `var'-1==2
}
Related Posts with replacing values of a newly generated variable by the values of previous variables using "foreach var of varlist"
fixed effect model in xtivreg2 and singletonsI am running a fixed-effect model using xtivreg2 in stata, where my panel variable is firms and my t…
how to use test postestimation after contrast with ar. following mixedHello, I am using Stata/SE 15.1. I have difficulties in running a post-estimation test using "test…
Problem with sureg: last estimates not foundDear All, I have a panel with the following structure: N=6 T=53 (monthly data). I am trying to esti…
What does the ivprobit command actually do?Dear statalisters, I've read dozens of times the ivprobit manual and searched for papers published o…
Tests to justify use of quantile regressionHi all. Can you suggest any formal statistical test/analysis in order to justify the application of …
Subscribe to:
Post Comments (Atom)
0 Response to replacing values of a newly generated variable by the values of previous variables using "foreach var of varlist"
Post a Comment