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

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

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.

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

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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 3 replies
  • 3312 views
  • 3 likes
  • 3 in conversation