BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Paul_NYS
Obsidian | Level 7

Hi

I have a data set that I run several frequencies and simple percents on which lead to an output similar to the below example file. One of the variables that I include in the many frequencies is an Exit Month time frame. For the Exit Month variable, I included a check for a 0 month option, but there are no values for 0 in the entire data set. Is there any way to include a 0 Exit Month value in the output from these SAS routines equaling a count of 0?

http://www.nycourts.gov/surveys/cwcip/procFreqOutput.zip

Below is one of the many frequencies that I run on this data set:

proc freq data=s1ageshort noprint;

  tables startyear*exit*agecat4*exitMonthCategory/out=s1ageshorttest sparse;

run;

Paul

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

PROC REPORT and TABULATE also support PRELOADFMT (with TABULATE, you need PRINTMISS and with REPORT, you need COMPLETEROWS option). TABULATE and MEANS will both use CLASSDATA. Check the documentation for which one applies to your situation.

  By way of explanation, PROC FREQ, with the SPARSE option will put a row for F age 16 into the FREQ output for SASHELP.CLASS because AGE 16 is in the data, but only for M age 16. However, AGE 10 is NOT in the dataset -- at all -- so the SPARSE option will not put AGE10 in the output. That is the kind of thing that REPORT and TABULATE and MEANS/SUMMARY will do.

cynthia

View solution in original post

3 REPLIES 3
data_null__
Jade | Level 19

You need a PROC that allows the creation of something from nothing.  SUMMARY/MEANS and TABULATE are two.  For SUMMARY/MEANS look at documentation concerning the CLASSDATA option and or PRELOADFMT.  You can get to the same place by either method.

Cynthia_sas
SAS Super FREQ

Hi:

PROC REPORT and TABULATE also support PRELOADFMT (with TABULATE, you need PRINTMISS and with REPORT, you need COMPLETEROWS option). TABULATE and MEANS will both use CLASSDATA. Check the documentation for which one applies to your situation.

  By way of explanation, PROC FREQ, with the SPARSE option will put a row for F age 16 into the FREQ output for SASHELP.CLASS because AGE 16 is in the data, but only for M age 16. However, AGE 10 is NOT in the dataset -- at all -- so the SPARSE option will not put AGE10 in the output. That is the kind of thing that REPORT and TABULATE and MEANS/SUMMARY will do.

cynthia

Paul_NYS
Obsidian | Level 7

Thanks Cynthia. That explains it then.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 3 replies
  • 2505 views
  • 3 likes
  • 3 in conversation