Dear all,
As you can see in Dataset1, I have 4 different variables (i.e. cases, codes, pyr, lvl and p). I would like to put the different observations into one observation without losing any information and I want to put the different codes and p's into different columns. I've tried the command collapse but that did not work out well for the different codes. Can someone help me please?
Dataset1:
The result that I would like to have:
Thank you in advance!
As you can see in Dataset1, I have 4 different variables (i.e. cases, codes, pyr, lvl and p). I would like to put the different observations into one observation without losing any information and I want to put the different codes and p's into different columns. I've tried the command collapse but that did not work out well for the different codes. Can someone help me please?
Dataset1:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int(cases codes yr) str3 mid byte lvl int p 123 345 2000 "C20" 5 1023 123 345 2000 "D40" 5 4798 123 345 2000 "G80" 5 6933 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int(cases codes yr) str3(mid1 mid2 mid3) byte lvl int p_mid1 byte I int(p_mid2 p_mid3) 123 345 2000 "C20" "D40" "G80" 5 1023 . 4798 6933 end
Comment