Hello,
I have a variable called HighEd1 that can assume values from 1 to 8 and each value stands for a specific label (eg 1=Degree level ;...;. 8=non-formal qualification).
I want to invert the scale of values so that becomes: 1=non-formal qualification;...; 8=Degree level.
I have been using the following code but is clearly wrong since the replacement is non-simultaneous but in succession and this leads to values that have been replaced before in time to be replaced again further down in the code.
I need a simultaneous (ie in one shot) code for replacement.
Wrong code:
replace HighEd1=8 if HighEd1==1
replace HighEd1=7 if HighEd1==2
replace HighEd1=6 if HighEd1==3
replace HighEd1=5 if HighEd1==4
replace HighEd1=3 if HighEd1==5
replace HighEd1=4 if HighEd1==6
replace HighEd1=2 if HighEd1==7
replace HighEd1=1 if HighEd1==8
thank you in advance!
Best,
Linda
Related Posts with How to reconvert the set of values that a variable can assume to a new set of values simultaneously
Adding character to string variable depending on the length of characters in the same stringHi, I've got a string variable, which should have 10 characters. I need to add a "0" in the front o…
Appending multiple filesHi all, I have 135 .dta files on a folder each for one month from 2004m1 to 2018m12. The files are …
Is it possibly to export xttrans results to Excel table?Hello! I am trying to figure out how to export results from xttrans command to an Excel file. My com…
Interpretation coefficientsHi all, I was wondering if someone could help me out with some questions I have regarding the inter…
RegressionHi, I have a question according to the significance of my data. The following graph shows the size …
Subscribe to:
Post Comments (Atom)
0 Response to How to reconvert the set of values that a variable can assume to a new set of values simultaneously
Post a Comment