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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.