Hi there. I am attempting to create a data set using the ODS OUTPUT and PROC FREQ statements. My goal is to only display the Chi-Square observation for the data.
I first ran ODS trace to find the name of the table I want:
ODS TRACE ON;
PROC FREQ DATA = WORK.data ;
TABLES var1* var2/ CHISQ ;
RUN;
ODS TRACE OFF;
Next, I created the data set with PROC FREQ:
ODS OUTPUT ChiSq = WORK.data2;
PROC FREQ DATA = WORK.data;
TABLES var1* var2/ NOCUM NOROW NOPERCENT NOCOL CHISQ;
/* WHERE Statistic = 'Chi-Square' ;*/
RUN;
=> as you can see, I tried using the WHERE syntax to keep only the Chi-Square observation, but this is the warning I receive in the log (see below). My goal is to have a data set with just Obs-1, Statistic = Chi-Square. Not sure what I'm doing incorrectly. Thank you!
305 ODS OUTPUT ChiSq = WORK.data2;
306 PROC FREQ DATA = WORK.data ;
307 TABLES var1 * var2/ NOCUM NOROW NOPERCENT NOCOL CHISQ;
308 WHERE Statistic = 'Chi-Square' ;
ERROR: Variable Statistic is not on file WORK.data.
309 RUN;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE FREQ used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
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.