DATA Step, Macro, Functions and more

list of variable in summary

Accepted Solution Solved
Reply
Contributor
Posts: 49
Accepted Solution

list of variable in summary

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;


Accepted Solutions
Solution
‎10-09-2014 03:07 PM
Trusted Advisor
Posts: 1,228

Re: list of variable in summary

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


All Replies
Solution
‎10-09-2014 03:07 PM
Trusted Advisor
Posts: 1,228

Re: list of variable in summary

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;

Contributor
Posts: 49

Re: list of variable in summary

thanks!!!

Super User
Posts: 11,343

Re: list of variable in summary

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

Trusted Advisor
Posts: 1,228

Re: list of variable in summary

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,


Contributor
Posts: 49

Re: list of variable in summary

hi ballardw,

I also got the problems with the names of variable,

and I resolved with yor suggestion.

thanks you!!

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 234 views
  • 3 likes
  • 3 in conversation