BookmarkSubscribeRSS Feed
rfarmenta
Obsidian | Level 7

Hi everyone,

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!

Best,

Richard, MPH/MA, PhD candidate

1 REPLY 1
Cynthia_sas
SAS Super FREQ

Hi:

  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:

http://www.nesug.org/proceedings/nesug07/ff/ff07.pdf

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):

http://www.nesug.org/proceedings/nesug07/cc/cc30.pdf

http://www2.sas.com/proceedings/forum2008/086-2008.pdf

cynthia

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 651 views
  • 0 likes
  • 2 in conversation