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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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