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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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