BookmarkSubscribeRSS Feed
x3d1m4
Fluorite | Level 6

Hello. I want to keep my variables, loop through all variables in the proc step separatly.

I have a large data set. For simplicity let's say he is infinite. I have created a list of variables that I want to work with. For example:

data test;
input X1 X2 X3 ...Xn;
cards;
1 2 3
4 5 6
7 8 9
;
run;

Generally i want use PROC STEP in each variable separately.

I choosed next variables X1, X3 and Xn (i dont know how to store this variable). And I want to do the next operations but macro:

proc mean data=test noprint; 
var x1;
output out=test_x1 mean= /autoname;
run;
proc mean data=test noprint;
var x3;
output out=test_x3 mean= /autoname;
run;
proc mean data=test noprint;
var xn;
output out=test_xn mean= /autoname;
run;

Also i can use _ALL_ but it's impossible, because dataset is "infinity".

Thanks in advance for any hint :).

 

2 REPLIES 2
ballardw
Super User

You might be better off actually describing in words what is supposed to happen instead of showing code that does not work.

Better would be to show code that does work that does not use any macro code.

 

Reeza
Super User
&let number_of_sampled_var=%let sample_variable =array {&number_of_sampled_var} X1,X3, ...Xn; */Here i want a put this list of variables */proc means data=test_statistic noprint;

 

I'm sorry but I cannot understand your code. What do you think it is doing and what do you want it to be doing?

 

I have a macro here that caps outliers, which seems similar to what you're trying to do here.

https://gist.github.com/statgeek/31316a678433a1db8136

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 2 replies
  • 368 views
  • 0 likes
  • 3 in conversation