BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
mikepark
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

Those variables are part of TableB, not TableA.  You would need to begin with something like:

 

data tableC;

set TableB;

View solution in original post

2 REPLIES 2
Astounding
PROC Star

Those variables are part of TableB, not TableA.  You would need to begin with something like:

 

data tableC;

set TableB;

mikepark
Obsidian | Level 7

Of course. I must have been sleepy.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1457 views
  • 1 like
  • 2 in conversation