DATA Step, Macro, Functions and more

create varariables form sas data

Reply
SAS Employee
Posts: 105

create varariables form sas data

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
Super User
Posts: 5,256

Re: create varariables form sas data

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
SAS Employee
Posts: 105

Re: create varariables form sas data

Hi Linus ,
Thanks for help !!
Ask a Question
Discussion stats
  • 2 replies
  • 106 views
  • 0 likes
  • 2 in conversation