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