2
votes

I have a short piece of SAS 9.3 code that outputs some Chi-squared statistics. I'm using ods select ChiSq to select only the tables of output I need, but SAS returns this warning:

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.

This is the code:

ods html;

data flu;
input gender treatmentcourse improvement;
datalines;
012
000
110
112
002
002
012
000
000
012
111
011
002
101
002
011
100
100
001
110
110
011
001
010
101
001
000
001
110
100
;

proc format;
value treatmentformat 0 = "minor"
                      1 = "minor"
                      2 = "major";

ods trace on;
ods select ChiSq;
proc freq data = flu order = data;
tables treatmentcourse * improvement /chisq cmh;
format treatmentcourse treatmentformat.;
run;
ods trace off;
ods select all;
ods html close;

I can clearly see as a result of ods trace on; that the ChiSq table is included in the output, but SAS ignores the ods select statement and displays all the tables.

In the datalines, the first colum is gender, 0 for males and 1 for females. The second column is 0 if the patient took the drug and 1 if the patient took the placebo. The third column is a scale of 0 - 2, 0 being no improvement in flu symptoms and 2 being much improvement.

1

1 Answers

4
votes

I think your problem is that you put your custom format on the wrong variable. Try this instead:

proc freq data = flu order = data;
   tables treatmentcourse * improvement /chisq cmh;
   format improvement treatmentformat.;
run;

If you look at your log more carefully, you should see a SAS NOTE that no statistics were created.

UPDATE: You also should put a run; statement after your proc format step, just to be safe.