Hi SAS Community,
I am working on a project in which I have a variable that is in quartiles. I need to compare these quartiles to 4 other numeric variables, and I wish for the table to be displayed with 6 columns: One for the variable names, one for the mean and standard deviation of each quartile (when compared to each of the 4 variables), and one for the p-value. Here is my code:
PROC GLM DATA = CoAnl.Combined_Analysis outstat= ANOVA_Results;
CLASS Quartiles_FOOD;
MODEL OUT_LWB DEM_POV DEM_EDU RISK_FOOD = Quartiles_FOOD;
MEANS Quartiles_FOOD/HOVTEST;
RUN;
data ANOVA_Results2;
set ANOVA_Results;
if PROB=. then delete;
run;
PROC SORT DATA=ANOVA_Results2 OUT= ANOVA_ResultsFinal NODUPKEY;
BY _NAME_;
RUN;
DATA TABLE2_FINAL;
SET ANOVA_ResultsFinal;
LABEL _NAME_='Variable' PROB='p-Value';
FORMAT _NAME_ $CHANGEVARNAME.;
RUN;
And here is the log:
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
68
69 PROC GLM DATA = CoAnl.Combined_Analysis outstat= ANOVA_Results;
70 CLASS Quartiles_FOOD;
71 MODEL OUT_LWB DEM_POV DEM_EDU RISK_FOOD = Quartiles_FOOD;
72 MEANS Quartiles_FOOD/HOVTEST;
73 RUN;
NOTE: The data set WORK.ANOVA_RESULTS has 12 observations and 7 variables.
NOTE: PROCEDURE GLM used (Total process time):
real time 0.53 seconds
user cpu time 0.35 seconds
system cpu time 0.04 seconds
memory 12075.12k
OS Memory 34880.00k
Timestamp 12/10/2023 10:33:07 PM
Step Count 470 Switch Count 4
Page Faults 0
Page Reclaims 3747
Page Swaps 0
Voluntary Context Switches 3008
Involuntary Context Switches 1
Block Input Operations 0
Block Output Operations 2432
74
75 data ANOVA_Results2;
76 set ANOVA_Results;
77 if PROB=. then delete;
78 run;
NOTE: There were 12 observations read from the data set WORK.ANOVA_RESULTS.
NOTE: The data set WORK.ANOVA_RESULTS2 has 8 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 952.93k
OS Memory 32936.00k
Timestamp 12/10/2023 10:33:07 PM
Step Count 471 Switch Count 2
Page Faults 0
Page Reclaims 126
Page Swaps 0
Voluntary Context Switches 11
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
79
80 PROC SORT DATA=ANOVA_Results2 OUT= ANOVA_ResultsFinal NODUPKEY;
81 BY _NAME_;
82 RUN;
NOTE: There were 8 observations read from the data set WORK.ANOVA_RESULTS2.
NOTE: 4 observations with duplicate key values were deleted.
NOTE: The data set WORK.ANOVA_RESULTSFINAL has 4 observations and 7 variables.
NOTE: PROCEDURE SORT used (Total process time):
real time 0.00 seconds
user cpu time 0.01 seconds
system cpu time 0.00 seconds
memory 1308.53k
OS Memory 33196.00k
Timestamp 12/10/2023 10:33:07 PM
Step Count 472 Switch Count 2
Page Faults 0
Page Reclaims 151
Page Swaps 0
Voluntary Context Switches 14
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 272
83
84 DATA TABLE2_FINAL;
85 SET ANOVA_ResultsFinal;
86 LABEL _NAME_='Variable' PROB='p-Value';
87 FORMAT _NAME_ $CHANGEVARNAME.;
88 *KEEP _NAME_ PROB;
89 RUN;
NOTE: There were 4 observations read from the data set WORK.ANOVA_RESULTSFINAL.
NOTE: The data set WORK.TABLE2_FINAL has 4 observations and 7 variables.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
user cpu time 0.00 seconds
system cpu time 0.00 seconds
memory 1065.65k
OS Memory 32936.00k
Timestamp 12/10/2023 10:33:07 PM
Step Count 473 Switch Count 2
Page Faults 0
Page Reclaims 129
Page Swaps 0
Voluntary Context Switches 14
Involuntary Context Switches 0
Block Input Operations 0
Block Output Operations 264
90
91 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
101
Currently, the output is displaying such variables as 'source' and 'type', but it is giving no data for the mean/std comparisons of the variables to the quartiles. What am I doing wrong? Thanks for your help.