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.

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

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
  • 1573 views
  • 1 like
  • 2 in conversation