If I understand your question, you want to control the output to HTML, and I'm not sure how to do that. It is possible to use the ODS tables to create output that you could print with other procedures. E.g., the following example will allow you to output the p value for a chi-square test statistic into one table (work.want1), and you could use a DATA step procedure to determine if the table outputted from the TABLES statement (work.crosstab1) should be retained. This example uses PROC FREQ, but ODS TABLE names are available in SURVEYFREQ: PROC SURVEYFREQ: ODS Table Names :: SAS/STAT(R) 9.3 User's Guide
ods tables ChisQ=want1;
proc freq data=sashelp.cars ;
tables type*origin / chisq out=crosstab1;
run;