@efboggs wrote:
Apologies @ballardw, here is my code attempting to apply a format-
ODS OUTPUT ChiSq = HypRslt.ChiSqResults ( KEEP = Statistic DF Value Prob WHERE = (Statistic = 'Chi-Square'));
PROC FREQ DATA = HypAnl.HypAnalysis2; TABLES HypRelDeathInd * StateCd / CHISQ NOPERCENT NOROW; FORMAT Value 4.2; FORMAT Prob 5.2; RUN;
Here is the log:
NOTE: ODS statements in the SAS Studio environment may disable some output features.
73
74
75 ODS OUTPUT ChiSq = HypRslt.ChiSqResults (KEEP= Statistic DF Value Prob
76 WHERE= (Statistic = 'Chi-Square'));
77 PROC FREQ
78 DATA = HypAnl.HypAnalysis2;
79 TABLESHypRelDeathInd * StateCd / CHISQ NOPERCENT NOROW;
80 FORMAT Value 4.2;
WARNING: Variable VALUE not found in data set HYPANL.HYPANALYSIS2.
81 FORMAT Prob 5.2;
WARNING: Variable PROB not found in data set HYPANL.HYPANALYSIS2.
82 RUN;
What is happening here, and will in a great many procedures is that the Syntax in the body of the procedure only applies to variables in the INPUT data set. The variables with the warnings are created by the ODS OUTPUT and the behind the scenes things that go on set the format, not your code at this time. Post processing to associate the formats with the specific output data set variables, or use of appropriate format an a different procedure that displays the values, such as Proc Print, Report or graphing procedure, is when the format would be used.
Some of the modeling procedures potentially produce over 20 ODS tables, some with similar named variables (Statistic is common) but may need different formats to be usable. So the procedures don't let you override the default template set formats in procedure code. Once the output is created then you can override as several examples show.
... View more