- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
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.