DATA Step, Macro, Functions and more

Selecting all variables

Accepted Solution Solved
Reply
Contributor
Posts: 40
Accepted Solution

Selecting all variables

If I have a large number of variables and I wish to perform a function that involves all of them ( say for example taking the sum of an observation across all the variables), is there a way to select all the variables rather than typing them in separately?

Thank you!

 

 


Accepted Solutions
Solution
‎08-19-2016 12:34 PM
Respected Advisor
Posts: 3,799

Re: Selecting all variables

data test;
   set sashelp.class;
   array _n[*] _numeric_;
   sum = sum(of _n[*]);
   run;

To learn more look in the documentation for "SAS Variable Lists"

 

View solution in original post


All Replies
Solution
‎08-19-2016 12:34 PM
Respected Advisor
Posts: 3,799

Re: Selecting all variables

data test;
   set sashelp.class;
   array _n[*] _numeric_;
   sum = sum(of _n[*]);
   run;

To learn more look in the documentation for "SAS Variable Lists"

 

Contributor
Posts: 40

Re: Selecting all variables

Posted in reply to data_null__
Thank you!
☑ This topic is solved.

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

Discussion stats
  • 2 replies
  • 251 views
  • 2 likes
  • 2 in conversation