BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hello,

I am trying to look at the effect of a drug on an outcome. The drug was used at different intervals through the observation period. I set up the data as below

NODAT Duration RAS1 RAS2 RAS3 etc for use in months 1, 2, 3 etc

and I used this syntax

proc phreg data=_proj_.imported;
model DURATION*NODAT(0) = cum AGE / risklimits;
array cum (*) RAS1-RAS12;
do i = 1 to 12;
if DURATION=i then cum=RAS; end; run;

and keep getting this error
ERROR: The name cum is already defined as a variable and cannot be redeclared as an array by the ARRAY statement

Thanks so much for any help,
2 REPLIES 2
plf515
Lapis Lazuli | Level 10
> Hello,
>
> I am trying to look at the effect of a drug on an
> outcome. The drug was used at different intervals
> through the observation period. I set up the data as
> below
>
> NODAT Duration RAS1 RAS2 RAS3 etc for use in months
> 1, 2, 3 etc
>
> and I used this syntax
>
> proc phreg data=_proj_.imported;
> model DURATION*NODAT(0) = cum AGE / risklimits;
> array cum (*) RAS1-RAS12;
> do i = 1 to 12;
> if DURATION=i then cum=RAS; end; run;
>
> and keep getting this error
> ERROR: The name cum is already defined as a variable
> and cannot be redeclared as an array by the ARRAY
> statement
>
> Thanks so much for any help,

I think it's in the last line. You have cum = RAS, shouldn't it be cum = ras

?

But what are you trying to do here? It's not clear to me.

Peter
Doc_Duke
Rhodochrosite | Level 12
In the MODEL statement, you have used cum as a variable. Then you have used cum as an array in the ARRAY statement. I think that you want to use ras (no subscript) in the model statement and then revers cum and ras in the IF statement.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 1341 views
  • 0 likes
  • 3 in conversation