In the data below, for each Treated_state I want to generate a new variable = s_"observation". So for Treated_state==Arun, I want a variable named s_arun; for Treated_state==Biha, I want a variable named s_biha, and so on. I also do not want any variables created for the observations where Treated_state==""
The only method I know of doing this is to reshape, but that causes other problems since I need this data structure to be preserved as is, and only these additional variables to be added. I'd greatly appreciate some help on this
The only method I know of doing this is to reshape, but that causes other problems since I need this data structure to be preserved as is, and only these additional variables to be added. I'd greatly appreciate some help on this
Code:
input str50 state str4 Treated_State byte treated int cem_strata double(cem_matched cem_weights) "Andaman and Nicobar Islands" "" 0 1 1 1 "Andhra Pradesh" "" 0 1 1 1 "Arunachal Pradesh" "Arun" 1 1 1 1 "Assam" "" 0 1 1 1 "Bihar" "Biha" 1 1 1 1 "Chandigarh" "" 0 3 0 0 "Chhattisgarh" "Chha" 1 1 1 1 "Dadra and Nagar Haveli and Daman and Diu" "" 0 1 1 1 "Delhi" "Delh" 1 4 0 0 "Goa" "" 0 1 1 1 "Gujarat" "" 0 1 1 1 "Haryana" "" 0 1 1 1 "Himachal Pradesh" "" 0 1 1 1 "Jammu and Kashmir" "" 0 1 1 1 "Jharkhand" "Jhar" 1 1 1 1 "Karnataka" "Karn" 1 1 1 1 "Kerala" "" 0 1 1 1 "Lakshadweep" "" 0 1 1 1 "Madhya Pradesh" "Madh" 1 1 1 1 "Maharashtra" "Maha" 1 1 1 1 "Manipur" "Mani" 1 1 1 1 "Meghalaya" "Megh" 1 1 1 1 "Mizoram" "" 0 1 1 1 "Nagaland" "Naga" 1 1 1 1 "Odisha" "Odis" 1 1 1 1 "Puducherry" "Pudu" 1 2 0 0 "Punjab" "Punj" 1 1 1 1 "Rajasthan" "" 0 1 1 1 "Sikkim" "" 0 1 1 1 "Tamil Nadu" "" 0 1 1 1 "Telangana" "" 0 1 1 1 "Tripura" "" 0 1 1 1 "Uttar Pradesh" "" 0 1 1 1 "Uttarakhand" "Utta" 1 1 1 1 "West Bengal" "" 0 1 1 1
Comment