I have a dataset that looks roughly like this:
data wide;
input id age gender nationality a_active b_active a_eligible b_eligible;
cards;
1 33 M X 0 1 1 0
;
run;
Desired output:
| id | age | gender | nationality | active_label | active_value | eligible_label | eligible_value |
|---|---|---|---|---|---|---|---|
| 1 | 33 | M | X | a | 0 | a | 1 |
| 1 | 33 | M | X | b | 1 | b | 0 |
I tried using proc transpose but I can't seem to figure out how to have multiple labels. I can do this with one label, not sure if that's the right way:
proc transpose data=wide out=long pefix=active_label;
by id age gender nationality;
var a_active b_active;
run;