Hello. My PI has asked me to create new rows from two existing variables (see num and den below). Using the first row (time "1") for id "1" as an example: he would like the counts of the num and den as separate rows.
The result for the first row would look something like this:
id time num den
1 1 0 1
1 1 0 1
1 1 0 1
1 1 1 1
1 1 1 1
I don't think this is a dummy variable transformation as additional rows that expand the panel are needed. Thank you in advance for your suggestions.
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte(id time num den) 1 1 2 5 1 2 4 5 1 3 1 5 1 4 2 5 1 5 0 5 2 1 5 5 2 2 1 5 2 3 5 5 2 4 3 5 2 5 2 5 3 1 0 5 3 2 0 5 3 3 3 5 3 4 1 5 3 5 4 5 4 1 2 5 4 2 3 5 4 3 5 5 4 4 3 5 4 5 2 5 5 1 4 5 5 2 5 5 5 3 2 5 5 4 3 5 5 5 4 5 end
id time num den
1 1 0 1
1 1 0 1
1 1 0 1
1 1 1 1
1 1 1 1
I don't think this is a dummy variable transformation as additional rows that expand the panel are needed. Thank you in advance for your suggestions.
Comment