Hi everyone, I have a problem when using the reshape wide command. In the example provided below I want to use the ID as an identifier, so that STATA generates data in wide format with "code" generated as Code 1, Code 2 etc for each unique code, but the ID is to mentioned only once. As for now I have "gen rowunique=_n" so that each row has a unique number. Not provided in the dataset below is "OnOff" which varies between 1 and 2, which is used in "j" in the reshape wide command. I then use reshape wide ID Code , i(rowunique) j(OnOff). However, this doesn't combine the data into one row as I would like it to. * Example generated by -dataex-. For more info, type help dataex clear input byte id str4(code) 1 "X001" 1 "X002" 1 "T004" 2 "X005" 2 "R001" end Your help is very much appreciated! Regards, Viktor
-
Login or Register
- Log in with

Comment