Hi everyone,
I have been struggling with this for a couple days, so hope somebody out there has done this before.
I have a dataset that is currently vertical, and I want to transpose it to be horizontal. That's no problem with PROC TRANSPOSE. The tricky part is that after the data is transposed, I need to assign labels to the new variables from a field that existed in the initial data.
Currently I have something like this:
variable_name field_label
INV Physician
INST Institution
I have transposed the dataset to this:
INV INST
Dr Joe Hospital1
Dr Jane Hospital2
What I am not sure how to do is assign the values from field_label to the INV and INST variables after the transpose. I have 397 rows in the intial dataset, and it can change in the future, so I really want to be able to do this dynamically.
Any suggestions?
Thanks!
IDLABEL option in PROC TRANSPOSE.
proc transpose data=.....;
...
idlabel field_label;
...
run;
@biglerc wrote:
Hi everyone,
I have been struggling with this for a couple days, so hope somebody out there has done this before.
I have a dataset that is currently vertical, and I want to transpose it to be horizontal. That's no problem with PROC TRANSPOSE. The tricky part is that after the data is transposed, I need to assign labels to the new variables from a field that existed in the initial data.
Currently I have something like this:
variable_name field_label
INV Physician
INST Institution
I have transposed the dataset to this:
INV INST
Dr Joe Hospital1
Dr Jane Hospital2
What I am not sure how to do is assign the values from field_label to the INV and INST variables after the transpose. I have 397 rows in the intial dataset, and it can change in the future, so I really want to be able to do this dynamically.
Any suggestions?
Thanks!
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.