## Proc Mean Output Rename & put variables new table

Solved
Super Contributor
Posts: 413

# Proc Mean Output Rename & put variables new table

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;

Accepted Solutions
Solution
‎09-25-2015 06:23 AM
Super User
Posts: 23,776

## Re: Proc Mean Output Rename & put variables new table

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.

All Replies
Posts: 1,147

## Re: Proc Mean Output Rename & put variables new table

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
Posts: 1,147

## Re: Proc Mean Output Rename & put variables new table

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
Super Contributor
Posts: 413

## Re: Proc Mean Output Rename & put variables new table

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;``````

I need other columns here ?

&

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

Thank you.

Super Contributor
Posts: 413

## Re: Proc Mean Output Rename & put variables new table

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

.

Super User
Posts: 13,583

## Re: Proc Mean Output Rename & put variables new table

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.

Super User
Posts: 23,776

## Re: Proc Mean Output Rename & put variables new table

Super Contributor
Posts: 413

## Re: Proc Mean Output Rename & put variables new table

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

Super User
Posts: 23,776

## Re: Proc Mean Output Rename & put variables new table

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?
Super Contributor
Posts: 413

## Re: Proc Mean Output Rename & put variables new table

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;``````

Solution
‎09-25-2015 06:23 AM
Super User
Posts: 23,776

## Re: Proc Mean Output Rename & put variables new table

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.
Super Contributor
Posts: 413

## Re: Proc Mean Output Rename & put variables new table

Thanks a lot. I made it.

🔒 This topic is solved and locked.