BookmarkSubscribeRSS Feed
yonib
SAS Employee
Hi all,
I have a question


If i have sas data that look like this:
name of table: a
vars: col1 col2

obs name gender


And also i have sas data like :
name of table: b
vars: col1 col2

obs: yoni m
aaa f
bbb m

What i want to do is to take all the the obs from table a and put then as vars on table b .

Does anyone knows how to do it?

thanks in advance
2 REPLIES 2
LinusH
Tourmaline | Level 20
You could use macro variables:

data _null_;
set a;
call symput('COL1',col1);
call symput('COL2',col2);
run;

proc datasets lib=work nolist;
modify b;
rename col1=&COL1 col2=&COL2;
quit;

/Linus
Data never sleeps
yonib
SAS Employee
Hi Linus ,
Thanks for help !!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 631 views
  • 0 likes
  • 2 in conversation