BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Rakeon
Quartz | Level 8

Hi to all,

I have to use the proc summary with a lot of ID variables.

How can I save the list of variables  in the macro variable?

is there one way to have a macro variables with a list of variable of dataset  but without the list in the  VAR ?

proc summary data = one

     var a b;

     id &listvariable.; in this macro variable, how can i put the list of variable of the data set one without the a,b variable  into the  VAR field?

output = have;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
stat_sas
Ammonite | Level 13

proc contents data=one out=varnames(keep=name);
run;

proc sql;
select name into :listvariable separated by ' ' from varnames
where name not in ('a','b');
quit;

%put &listvariable;

View solution in original post

5 REPLIES 5
stat_sas
Ammonite | Level 13

proc contents data=one out=varnames(keep=name);
run;

proc sql;
select name into :listvariable separated by ' ' from varnames
where name not in ('a','b');
quit;

%put &listvariable;

Rakeon
Quartz | Level 8

thanks!!!

ballardw
Super User

Need to use the upper case versions of the variable names I believe.

stat_sas
Ammonite | Level 13

Hi ,

In proc contens output dataset variable names appearing in the same case as appeared in sources dataset. As per your suggestion it would be better to use upcase function and use upper case variable names. Please advise If I did not understand your question correctly.

Regards,


Rakeon
Quartz | Level 8

hi ballardw,

I also got the problems with the names of variable,

and I resolved with yor suggestion.

thanks you!!

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 968 views
  • 3 likes
  • 3 in conversation