proc transpose data=TableA out=TableB prefix=name_;
by &key.;
var name;
run;
The output table from the proc transpose has 3 columns that I need to merge.
The columns are name_1, name_2, and name_3.
How do I combine these columns together?
I tried this below and it did not work. I keep getting an error that the variables that were created during the proc transpose are not initialized. I see them in the data set so I don't understand why I can't use them.
data TableB(keep=patient_id drug_id drug_combo);
set TableA;
drug_combo = cats(' ', trim(name_1), trim(name_2), trim(name_3));
run;
Those variables are part of TableB, not TableA. You would need to begin with something like:
data tableC;
set TableB;
Those variables are part of TableB, not TableA. You would need to begin with something like:
data tableC;
set TableB;
Of course. I must have been sleepy.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.