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
Diamond | Level 26

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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