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;
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.
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;
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;
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.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.