08-03-2011 02:42 PM
I am new to the communities and still have a lot to learn about SAS. I am running a simple procedure to look at the frequencies of variables in a dataset and then to do a crosstab of the outcome of interest with all the variables in the dataset. I am new to writing ODS output statements and can write a simple statement but was wondering if someone could help me with formatting.
Basically with the proc frec procedure I want to do basic descriptives and then have one table that has the variable names, formatting and then the frequency and percent only without the cumulative frequency or percent.
Then with the proc freq procedure I will run a crosstab with the outcome of interest by all the variables and I want the table to show those results in an ODS output.
How do I do this most efficiently? Thank you in advance for your help!
Richard, MPH/MA, PhD candidate
08-04-2011 08:50 AM
I'm not sure what you mean by an "ODS output" -- since you have ODS RTF in the title of your post, I figure you already know the basic "sandwich" technique:
ods rtf file='xxx.rtf' style=journal;
** proc freq code;
ods rtf close;
Meanwhile, PROC FREQ has options (NOCUM, NOPERCENT, etc) that allow you to tailor the output from PROC FREQ. Normally, when folks talk about ODS "output" they mean 1 of 2 things: the ODS "output" file -- i.e., the RTF file that you get from using the "sandwich" or they mean creating a SAS dataset from the ODS "OUTPUT" destination.
Here's a paper that talks about using PROC FREQ:
and here's a few papers that talk about using ODS TRACE and the ODS OUTPUT destination to create SAS datasets (but if you're talking about getting a crosstab report, generally, to me, that implies the RTF file):