BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ssills24
Calcite | Level 5

Hello, 

 

I am trying to create a SAS output table using PROC FREQ, and I only want the Test, DF, Value, and Prob columns. However, I need to rename the prob column to P-Value. Whenever I run the code below, I receive an error saying that the variable Prob does not exist. 

 

ODS OUTPUT ChiSq = ChiSqResults (DROP = Table WHERE = (Statistic = 'Chi-Square') RENAME = (Prob = P-Value);
PROC FREQ DATA = HypAnalysis2;
TABLES HypRelDeathInd*StateCd / NOCUM NOCOL NOROW NOPERCENT CHISQ;
RUN;

PROC PRINT DATA = ChiSqResults NOOBS;
RUN;

 

I would appreciate any help! Thank you. 

1 ACCEPTED SOLUTION

Accepted Solutions
andreas_lds
Jade | Level 19

@ssills24 wrote:

Hello, 

 

I am trying to create a SAS output table using PROC FREQ, and I only want the Test, DF, Value, and Prob columns. However, I need to rename the prob column to P-Value. Whenever I run the code below, I receive an error saying that the variable Prob does not exist. 

 

ODS OUTPUT ChiSq = HypRslt.ChiSqResults (DROP = Table WHERE = (Statistic = 'Chi-Square') RENAME = (Prob = P-Value);
PROC FREQ DATA = HypAnl.HypAnalysis2;
TABLES HypRelDeathInd*StateCd / NOCUM NOCOL NOROW NOPERCENT CHISQ;
RUN;

PROC PRINT DATA = HypRslt.ChiSqResults NOOBS;
RUN;

 

I would appreciate any help! Thank you. 


The code should generate more error messages than the one you are mentioning. Also note that "P-Value" is not a valid name for a sas variable. If you need to have "P-Value" as heading when printing the dataset, use a label:

proc print data = hyprslt.chisqresults noobs label;
  label prob = 'P-Value';
run;

View solution in original post

1 REPLY 1
andreas_lds
Jade | Level 19

@ssills24 wrote:

Hello, 

 

I am trying to create a SAS output table using PROC FREQ, and I only want the Test, DF, Value, and Prob columns. However, I need to rename the prob column to P-Value. Whenever I run the code below, I receive an error saying that the variable Prob does not exist. 

 

ODS OUTPUT ChiSq = HypRslt.ChiSqResults (DROP = Table WHERE = (Statistic = 'Chi-Square') RENAME = (Prob = P-Value);
PROC FREQ DATA = HypAnl.HypAnalysis2;
TABLES HypRelDeathInd*StateCd / NOCUM NOCOL NOROW NOPERCENT CHISQ;
RUN;

PROC PRINT DATA = HypRslt.ChiSqResults NOOBS;
RUN;

 

I would appreciate any help! Thank you. 


The code should generate more error messages than the one you are mentioning. Also note that "P-Value" is not a valid name for a sas variable. If you need to have "P-Value" as heading when printing the dataset, use a label:

proc print data = hyprslt.chisqresults noobs label;
  label prob = 'P-Value';
run;