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
Don't understand what marginsplot is doing.I have run a simple regression model followed by a request for margins as follows: Code: . regSco…
Invalid Name Using ReplaceHello, I was trying to replace the value of some variables. My code is: replace a867_2900 = 375000…
STATA Gurus: Please check my first regression results and comment on them!Array Dear All, Could you please check my first regression results (attached the excel file) and com…
Create a categorical from several continuous variables?Hi all, Back with another simple question on variable creation that is nonetheless stumping me. I h…
Random effect panel regression for Exchange rate's influence on exportsDear Community, I am new on this forum and hope to proceed in the correct way and according to rules…
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