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;

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 2201 views
  • 0 likes
  • 2 in conversation