BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
turcay
Lapis Lazuli | Level 10

At the following code i don't want to change columns name when i use to output option .How can i prevent this. And i wonder if i need to use more VAR variable im Mean procedure how can i do it. If i do it, is it possible to make sort this values on new table ?

Thank you.

 

PROC MEANS DATA=WORK.X1 noprint
FW=12
PRINTALLTYPES
CHARTYPE
QMETHOD=OS
VARDEF=DF
MEAN
STD
MODE
P10
P90 ;
VAR F2;
ods output summary=sample;
RUN;
data newStep;
set work.sample;
Slope=2.95/(((F2_P90-F2_Mode)*2+F2_Mode)-(F2_Mode));
Median=((F2_P90-F2_Mode)*2+F2_Mode)-((F2_Mode)-(F2_P90-F2_Mode)*2)/2;
run;

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User
Several ways
1) var q1-q1000;
2) var q:;
3) var q1--q1000; used when variables are listed side by side but not necessarily all present or in order.

View solution in original post

11 REPLIES 11
Jagadishkatam
Amethyst | Level 16
did you try the autoname= option in proc meand. This automatically rename the new variables created by concatenating the statistical var with var statement variable. So the new variables will be named as mean_f2. Hope this is what you are expecting.
Thanks,
Jag
Jagadishkatam
Amethyst | Level 16

you can use more var variables in proc means by just mentioning the numeric variable names in the var statement separated by space. And in the output out statement , use the autoname option so that the descriptic statistics produced will represent the respective statistics concatenated with variable names.Try the code something like below

 

proc means data=have mean std min max;
var var1 var2;
output out=want mean= std= min= max= / autoname;
run;

Thanks,

Jag

Thanks,
Jag
turcay
Lapis Lazuli | Level 10

Thanks a lot but how can i prevent first two column and it brings just one raw in output?

proc means data=SampleData mean std mode P10 P90
FW=12  
	PRINTALLTYPES
	CHARTYPE
	QMETHOD=OS
	VARDEF=DF 	
		MEAN 
		STD 
		MODE 	
		P10 
		P90
 ;
var Q1 Q2;
output out=want mean=mean std=std mode=mode P10=P10 P90=P90;
run;

data newsample;
set work.sample;
Slope=2.95/(((P90-Mode)*2+Mode)-(Mode));
Median=((P90-Mode)*2+Mode)-((Mode)-(P90-Mode)*2)/2;
run;

nolabel.png

I need other columns here ?

 

&

 

If i need to add thousands VAR in the proc means procedure  how can i made it ?

 

Thank you.

 

 

turcay
Lapis Lazuli | Level 10

I'll take thousands column and I want to see output like this.

.output.png

ballardw
Super User

You can get all numeric variables on the VAR statement using a special list: _numeric_

 

as in

VAR _numeric_;

 

Or NO VAR statement at all will summarize all numeric variables in the data.

 

 

 

 

turcay
Lapis Lazuli | Level 10

Thanks again but I tried it and it didn't work.

Reeza
Super User
That's not helpful. How did it not work? What was your code? What does your data look like and what output do you want? Was there any errors?
turcay
Lapis Lazuli | Level 10

I tried again and i made it, thank you. Now my last question is how can i add thousands columns on VAR expression from another data set.

proc means data=WORK.sample STACKODS
FW=12
     PRINTALLTYPES
     CHARTYPE
     QMETHOD=OS
     VARDEF=DF 
           MEAN 
           STD 
           MODE    
           P10 
           P90 ;
var Q1 Q2 Q3;
ods output summary=stacked;
run;
/*This code gives multiple row output*/



%let number=????
proc means data=WORK.sample STACKODS
FW=12
     PRINTALLTYPES
     CHARTYPE
     QMETHOD=OS
     VARDEF=DF 
           MEAN 
           STD 
           MODE    
           P10 
           P90 ;
var Q1 Q2 Q3........Q10000;
ods output summary=stacked;
run;

 

 

Reeza
Super User
Several ways
1) var q1-q1000;
2) var q:;
3) var q1--q1000; used when variables are listed side by side but not necessarily all present or in order.
turcay
Lapis Lazuli | Level 10

Thanks a lot. I made it. 🙂

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 11 replies
  • 10501 views
  • 0 likes
  • 4 in conversation