BookmarkSubscribeRSS Feed
rdevoss
Fluorite | Level 6
ODS trace on;
proc freq data = data;
tables hypreldeathind*statecd / norow nopercent nocum missing chisq;
run;
ods trace off;

Ods output crosstabfreqs = want (keep = StateCd HypRelDeathInd Frequency ColPercent

 where = (StateCd IN ('IA' 'MS' 'UT') and HypRelDeathInd = 1 and Missing(StateCd = 0)))
 chisq = hyprslt.chisqresults (drop = Table Where = (statistic = 'Chi Square')) ;
 
Proc Print data=data;
run;

Proc contents data = data;
run;

Proc print data=data;
run;

I'm receiving errors that the data tables do not exist. It looks like I'm creating them correctly in ODS output though.

 

This may be related to warning messages received in log -- 

 WARNING: Output 'chisq' was not created.  Make sure that the output object name, label, or path is spelled correctly.  Also, verify 
          that the appropriate procedure options are used to produce the requested output object.  For example, verify that the 
          NOPRINT option is not used.
 WARNING: Output 'crosstabfreqs' was not created.  Make sure that the output object name, label, or path is spelled correctly.  
          Also, verify that the appropriate procedure options are used to produce the requested output object.  For example, verify 
          that the NOPRINT option is not used.

Any ideas?

1 REPLY 1
ballardw
Super User

ODS OUTPUT statement needs to come either immediately before the Proc Freq code or in the body of Proc Freq before a Run; statement.

 

Since you have it after Proc Freq then the proc did not know you were requesting the output and none was created.

 

Your teacher must be pretty mediocre as we have seen many of you with the exact same question and code out of place.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

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

Browse our catalog!

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