- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm using SAS EG and doing a Historgram using PROC UNIVARIATE (SAS EG 6.1 running SAS 9.2 TS2M3 on LINUX). I'm suppressing the actual charts but putting the output variables to a table (mean, std, median, var, etc). Is there a way to format these output variables to something like 8.2 or the like in the actual PROC itself? I could create another datastep to do this but I don't want to add another step. There's probably no way using the actual Distribution 'node' in EG, but maybe just using the SAS code for PROC UNIVARIATE?
Thanks,
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You can modify the output template using PROC TEMPLATE. @Bari_sas recently shared an example that might be really useful for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I'll check this out. I'm very much a novice with PROC TEMPLATE. Been writing code for 23 years...never used PROC TEMPLATE. 😞
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm using SAS EG and doing a Historgram using PROC UNIVARIATE (SAS EG 6.1 running SAS 9.2 TS2M3 on LINUX). I'm suppressing the actual charts but putting the output variables to a table (mean, std, median, var, etc). Is there a way to format these output variables to something like 8.2 or the like in the actual PROC itself? I could create another datastep to do this but I don't want to add another step. There's probably no way using the actual Distribution 'node' in EG, but maybe just using the SAS code for PROC UNIVARIATE?
Thanks,
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
When you switch to SAS 9.3+ you can use STACKODS in proc means, but before that I think you're stuck with manipulating the data 😞
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Ok, thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Here's an example of STACKODSOUTPUT (scroll way down in the blog for explanation). Code:
/* Use the STACKODSOUTPUT option on the PROC MEANS statement */
/* and use the ODS OUTPUT statement to create output data set. */
ods output summary=with_stackods(drop=_control_);
proc means data=sashelp.class stackodsoutput sum mean std nway;
class sex;
var height weight;
run;
proc print data=with_stackods noobs;
title 'Output data set with STACKODSOUTPUT';
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
An alternative to STACKODS output is to use the OUTTABLE= option in PROC UNIVARIATE. This enables you to write all descritive statistics to a SAS data set with minimal effort. It is eons old, so it is surely included in whatever version of SAS you are running. For an example, see the article "Save descriptive statistics for multiple variables in a SAS data set."
Remember, too, that you don't need to use a DATA step to change the format for some variable. You can use the FORMAT statement in any SAS procedure to temprarily assign a format to a variable for the duration of that procedure. For example:
proc print data=have;
format x y z 8.2;
var x y z;
run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
If you do end up using PROC TEMPLATE, I was in the same position as you about 6 months ago. The SAS documentation isn't bad, but I found what really helped was googling whatever the particular thing I was trying to do. There's a huge number of absolutely fantastic SGF papers that solved (almost) every problem I had.
Tom
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
That EXCELLENT...and good to know. I need to start familiarizing myself with that stuff 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
To add to Tom's great suggestion, search on lexjansen.com to limit your search to SAS papers.