Based on a similar discussion in Problem with -reshape long- applying value label to j values - Statalist, the j(newvar) variable after -reshape long- takes on strange value labels.
The following is reduced dataset in long format after reshaping:
Before reshaping, the data looked like this:
To which I applied the simple command, as I usually do:
I do not understand why in the dataset above, value labels "51-52", "53+", and "tot" come from. These values are nowhere in my code, nor in my dataset. However, I now see that dataex reports the section:
Which I did not write myself. This seems to be a bug in stata reshape.
The following is reduced dataset in long format after reshaping:
Code:
* Example generated by -dataex-. For more info, type help dataex clear input byte(panelid2 wave) str6 hhid str8 id float var 1 1 "000064" "00006401" .6229963 1 2 "000064" "00006401" .6187591 1 3 "000064" "00006401" .0485496 1 4 "000064" "00006401" .21651682 1 5 "000064" "00006401" .6109347 2 1 "000064" "00006402" .3473928 2 2 "000064" "00006402" .007756131 2 3 "000064" "00006402" .6543282 2 4 "000064" "00006402" .008100444 2 5 "000064" "00006402" .8569513 3 1 "000214" "00021401" .4994775 3 2 "000214" "00021401" .3270546 3 3 "000214" "00021401" .07871727 3 4 "000214" "00021401" .6700594 3 5 "000214" "00021401" .1014784 4 1 "000214" "00021402" .7776048 4 2 "000214" "00021402" .05866977 4 3 "000214" "00021402" .26950312 4 4 "000214" "00021402" .6614817 4 5 "000214" "00021402" .13838032 end label values wave agecl label def agecl 1 "51-52", modify label def agecl 2 "53+", modify label def agecl 3 "tot", modify
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str6 hhid str8 id float(var1 var2 var3 var4 var5) byte panelid2 "000064" "00006401" .7488847 .4792806 .29489282 .789392 .3904327 1 "000064" "00006402" .7396652 .409892 .474054 .4045655 .5660811 2 "000214" "00021401" .83459 .3540865 .9541889 .6604541 .9541239 3 "000214" "00021402" .1537002 .8376353 .8663253 .2670887 .51788366 4 end
HTML Code:
reshape long var, i(panelid2) j(wave)
HTML Code:
label values wave agecl label def agecl 1 "51-52", modify label def agecl 2 "53+", modify label def agecl 3 "tot", modify
Comment