Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str43 Q2_8a1 double(Q2_8b1 Q2_8c1 Q2_8d1 Q2_8e1) str43 Q2_8a2 double(Q2_8b2 Q2_8c2 Q2_8d2 Q2_8e2) str43 Q2_8a3 double(Q2_8b3 Q2_8c3 Q2_8d3 Q2_8e3) "anil mongar" 24 1 10 1 "" . . . . "" . . . . "Nir mala" 34 2 21 1 "" . . . . "" . . . . "Suk mith lepcha" 64 2 21 1 "" . . . . "" . . . . "pemba lepcha" 50 1 3 1 "" . . . . "" . . . . "sangay tenzin" 77 1 8 1 "" . . . . "" . . . . "Nar Badhur" 32 1 7 1 "" . . . . "" . . . . "Pema Wangmo Lepcha" 29 2 5 1 "" . . . . "" . . . . "neelam" 40 2 12 2 "" . . . . "" . . . . "tandin bida" 43 2 10 1 "" . . . . "" . . . . "" . . . . "" . . . . "" . . . . "Durga" 31 1 8 1 "" . . . . "" . . . . "nim dem" 23 2 12 1 "" . . . . "" . . . . "" . . . . "" . . . . "" . . . . "Namgay Dem" 32 2 8 1 "" . . . . "" . . . . "kumari tamang" 41 1 21 1 "" . . . . "" . . . . "Phuntsho wangdi" 48 1 9 1 "" . . . . "" . . . . "Chungku" 27 2 2 1 "" . . . . "" . . . . "Deoraj Gurung" 43 1 17 1 "" . . . . "" . . . . "" . . . . "" . . . . "" . . . . "ganga maya ghally" 45 2 21 1 "" . . . . "" . . . . end label values Q2_8c1 Q2_8c label values Q2_8c2 Q2_8c label values Q2_8c3 Q2_8c label def Q2_8c 1 "Male", modify label def Q2_8c 2 "Female", modify label values Q2_8d1 Q2_8d label values Q2_8d2 Q2_8d label values Q2_8d3 Q2_8d label def Q2_8d 2 "Grade 2", modify label def Q2_8d 3 "Grade 3", modify label def Q2_8d 5 "Grade 5", modify label def Q2_8d 7 "Grade 7", modify label def Q2_8d 8 "Grade 8", modify label def Q2_8d 9 "Grade 9", modify label def Q2_8d 10 "Grade 10", modify label def Q2_8d 12 "Grade 12", modify label def Q2_8d 17 "Bachelor's degree", modify label def Q2_8d 21 "No education", modify label values Q2_8e1 Q2_8e label values Q2_8e2 Q2_8e label values Q2_8e3 Q2_8e label def Q2_8e 1 "Bhutanese", modify label def Q2_8e 2 "Indian", modify
How can i use loop to rename all variables from Q2_8a as name1,Q2_8b as age1 Q8_8c as sex1 Q8_8d as edu_level1 and Q8_8e nationaliy1 ajnd simultaneously name2, age2, sex2, edu2, nationality2
0 Response to renaming using loop
Post a Comment