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

I am having an issue with formatting/ proc phreg, i'll attach my code below:

support 1.PNG

support 2.PNGsupport 3.PNG

However, doing this gives me this error code:

ERROR: Variable SEX in WORK.COVS does not have the same format as in the input data

 

Can anyone please help me spot my mistake, I am completely lost, thankyou

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @rachelm22,

 

Does variable SEX in dataset work.sasp have values 1 for males and 2 for females (as in dataset covs)? If so, it should be sufficient to copy the FORMAT statement from your DATA step into the PROC PHREG step:

proc phreg data = WORK.sasp plots(overlay=group)=(survival);
format SEX SEX.;
class SEX;
...

Also, you may want to specify an output dataset name (with the OUT= option) in the BASELINE statement so that SAS doesn't create datasets with default names using the DATAn convention.

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

Can you please show us the LOG so we can see the code and the error in the sequence shown in the log. Seeing errors detached from the code is not really that helpful.

 

Please copy the log as text, not as a screen capture, and paste it into your reply by clicking on the </> icon and pasting it into the window that appears. Thanks!

--
Paige Miller
rachelm22
Fluorite | Level 6
289  proc phreg data = WORK.sasp plots(overlay=group)=(survival);
290  class SEX;
291  model TIMEE*CENSE(0)=SEX|AGE BMI|BMI KCAL;
292  baseline covariates=covs  / rowid=BMI group=SEX;
293  run;

ERROR: Variable SEX in WORK.COVS does not have the same format as in the input data.
NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.DATA8 may be incomplete.  When this step was stopped there were 0
         observations and 0 variables.
NOTE: PROCEDURE PHREG used (Total process time):
      real time           0.03 seconds
      cpu time            0.06 seconds
rachelm22
Fluorite | Level 6
proc format;
value SEX 1 = "male" 2 = "female";
run;
data covs;
format SEX SEX.;
input SEX BMI AGE KCAL;
datalines;
1 25 49.5 1981.95
1 30 49.5 1981.95
1 40 49.5 1981.95
2 25 49.5 1981.95
2 30 49.5 1981.95
2 40 49.5 1981.95
;
run;
PROC PRINT DATA= covs;
run;
Proc contents data=covs;
run;
proc phreg data = WORK.sasp plots(overlay=group)=(survival);
class SEX;
model TIMEE*CENSE(0)=SEX|AGE BMI|BMI KCAL;
baseline covariates=covs  / rowid=BMI group=SEX;
run;

above is my code 

FreelanceReinh
Jade | Level 19

Hi @rachelm22,

 

Does variable SEX in dataset work.sasp have values 1 for males and 2 for females (as in dataset covs)? If so, it should be sufficient to copy the FORMAT statement from your DATA step into the PROC PHREG step:

proc phreg data = WORK.sasp plots(overlay=group)=(survival);
format SEX SEX.;
class SEX;
...

Also, you may want to specify an output dataset name (with the OUT= option) in the BASELINE statement so that SAS doesn't create datasets with default names using the DATAn convention.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1075 views
  • 1 like
  • 4 in conversation