Hello, I am trying to reshape data from wide to long with several variables.
1) Is there a way I can reshape without listing all the variables bearing in mind that the prefixes and suffixes are in different combinations. I have seen a couple of examples on the forum; however, mainly the examples are for those with consistent labeling of variable suffixes and prefixes. Here is an example of the dataset.
[CODE]
* Example generated by -dataex-. For more info, type help dataex
clear
input byte(ALC8DDLY ALC8DTYP ALC8DWKY ALC8G7 ALC8_1 BPC8_10 BPC8_12 CCC8DANY CCC8GNUM CCC8_1A DGC8F1 DGC8G3A DGC8G3B DGC8_1A DGC8_1B DGC8_1C FH_8_38F FH_8_38G FIC8F1 FIC8_1 FIC8_2)
0 2 0 .a 1 1 1 1 3 2 1 14 .a 1 2 2 2 2 2 2 2
.a 3 .a .a 2 1 1 1 3 2 1 3 1 1 2 2 .a .a 2 2 2
0 1 0 .a 1 1 1 1 3 2 1 14 1 2 2 2 .a .a 2 2 2
end
thanks in advance
1) Is there a way I can reshape without listing all the variables bearing in mind that the prefixes and suffixes are in different combinations. I have seen a couple of examples on the forum; however, mainly the examples are for those with consistent labeling of variable suffixes and prefixes. Here is an example of the dataset.
[CODE]
* Example generated by -dataex-. For more info, type help dataex
clear
input byte(ALC8DDLY ALC8DTYP ALC8DWKY ALC8G7 ALC8_1 BPC8_10 BPC8_12 CCC8DANY CCC8GNUM CCC8_1A DGC8F1 DGC8G3A DGC8G3B DGC8_1A DGC8_1B DGC8_1C FH_8_38F FH_8_38G FIC8F1 FIC8_1 FIC8_2)
0 2 0 .a 1 1 1 1 3 2 1 14 .a 1 2 2 2 2 2 2 2
.a 3 .a .a 2 1 1 1 3 2 1 3 1 1 2 2 .a .a 2 2 2
0 1 0 .a 1 1 1 1 3 2 1 14 1 2 2 2 .a .a 2 2 2
end
thanks in advance
Comment