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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.