BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Thalitacosta
Obsidian | Level 7

How to put the following statistics in output data:

 

proc means data=&bib..&base. n sum min p1 p5 p10 p25 p50 p75 p90 p95 p99 max mean missing;

var &vari.;

run;

 

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

For an example and discussion, see the article, "Save descriptive statistics for multiple variables in a SAS data set."

 

The article shows two solutions:

1. Use PROC MEANS. If you do this, be sure to use the STACKODSOUTPUT option

proc means data=&bib..&base.
           N sum min p1 p5 p10 p25 p50 p75 p90 p95 p99 max mean missing
           STACKODSOUTPUT;        /* preserve table form of output */
ods output Summary=MeansSummary;  /* write statistics to data set */
run;

proc print data=MeansSummary; run;

2. Use PROC UNIVARIATE and the OUTTABLE= option. See the article for the syntax and example.

View solution in original post

3 REPLIES 3
Reeza
Super User

https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/p17h6q7ygvkl1sn13qzf947dundi.htm#p17h6q7...

 

 

For your code I would use ODS OUTPUT.

 

proc means data=&bib..&base. n sum min p1 p5 p10 p25 p50 p75 p90 p95 p99 max mean missing stackodsoutput;
var &vari.;
ods output summary=want;
run;

proc print data=want;run;

@Thalitacosta wrote:

How to put the following statistics in output data:

 

proc means data=&bib..&base. n sum min p1 p5 p10 p25 p50 p75 p90 p95 p99 max mean missing;

var &vari.;

run;

 


 

PaigeMiller
Diamond | Level 26
proc summary data=sashelp.class;
var height weight age;
output out=stats  n= sum= min= p1= p5= p10= p25= p50= p75= p90= p95= p99= max= mean= nmiss=/autoname;
run;
--
Paige Miller
Rick_SAS
SAS Super FREQ

For an example and discussion, see the article, "Save descriptive statistics for multiple variables in a SAS data set."

 

The article shows two solutions:

1. Use PROC MEANS. If you do this, be sure to use the STACKODSOUTPUT option

proc means data=&bib..&base.
           N sum min p1 p5 p10 p25 p50 p75 p90 p95 p99 max mean missing
           STACKODSOUTPUT;        /* preserve table form of output */
ods output Summary=MeansSummary;  /* write statistics to data set */
run;

proc print data=MeansSummary; run;

2. Use PROC UNIVARIATE and the OUTTABLE= option. See the article for the syntax and example.

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!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 630 views
  • 2 likes
  • 4 in conversation