BookmarkSubscribeRSS Feed
bhufman
Calcite | Level 5

I am trying to get this output to run for a Chi Square, here is my Code:

ODS Trace on;
Proc Freq Data=hypanl.hypanalysis2;
Tables hypreldeathInd * StateCd / Nopercent norow nocum chisq;
Run;
ODS Trace Off;

ODS OUTPUT CrossTabFreqs=HRslt.Percents (KEEP = Cd DeathInd Frequency ColPercent
WHERE = (DeathInd = 1 AND MISSING (Cd)=0));

ODS OUTPUT Chisq=HRslt.ChiSqResults
(DROP=TABLE
WHERE= (Statistic= 'Chi Square'));


PROC PRINT DATA=H.Percents;
RUN;
PROC PRINT DATA=H.ChiSqResults;
RUN;

I am getting this Error in the log:

ERROR: File H.ChiSq.DATA does not exist.
91 RUN;
And these Warnings:
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 suggestions on whats happening, particularly with the Error...
5 REPLIES 5
PaigeMiller
Diamond | Level 26

Your ODS OUTPUT statements belong immediately before or inside PROC FREQ. It doesn't work where you put it, after PROC FREQ ended.

--
Paige Miller
bhufman
Calcite | Level 5
Thanks for this tip! I'm still getting the warning about the output for ChiSq and the Error that the ChiSq File doesn't exist.
PaigeMiller
Diamond | Level 26

Show us the log for your PROC FREQ, including all WARNINGs, ERRORs, NOTEs and the actual code for PROC FREQ as it appears in the log. Do not chop anything out.

 

Please provide the log following these instructions (and not via any other method): copy the log as text from the SAS log window, and paste it into the window that appears when you click on the </> icon.

--
Paige Miller
bhufman
Calcite | Level 5

 

 

 

 

 

 

PaigeMiller
Diamond | Level 26

Maxim 2: Read the log.

 

 NOTE: No statistics are computed for HypRelDeathInd * StateCd because HypRelDeathInd has fewer than 2 nonmissing levels.

 

Your data is not appropriate for this test.

--
Paige Miller

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
  • 5 replies
  • 1550 views
  • 0 likes
  • 2 in conversation