BookmarkSubscribeRSS Feed
LeenDS
Calcite | Level 5

Hi all,

I have a dataset that includes rows with

- people who viewed TV advertisements at a given time, and whether or not these people visited the website of the advertiser afterwards (+ the timestamp of this visit)

- a match for each of these people who did NOT see the TV advertisement at this same time, and whether or not these people visited the website of the advertiser afterwards (+ the timestamp of this visit)

To give a simplified idea:

LeenDS_2-1664810918452.png

On each row we also have a bunch of dummy variables for the week, weekend vs weekday, daypart (primetime etc).

 

I use PROC PHREG to model the duration of the treatment effect (=seeing a TV ad) on online response (web visit). We included a random term for the advertisement, because the same advertisement is shown many times on different timestamps and to different people.

 

We would like to produce a hazard graph including the time-related control variables + including the random term. Is that possible?

Ideally, I'd get something similar to the below output that I generated with PROC LIFETEST, but including control variables and the random term (which is not possible with PROC LIFETEST).

LeenDS_1-1664810545255.png

 

PROC PHREG only produces a cumulative hazard graph and a survival graph. By using the COVS statement, I can control for the time-related variables. For now, I calculated the hazard rates by doing cumhaz - lag(cumhaz) directly in the output dataset. Not sure if this is allowed?

Also, I cannot produce any output results if I include the random statement (The PLOTS=, OUTPUT=, ... options are ignored for a frailty model analysis). Does anyone know of a method to go around this?

 

 

Thank you so much in advance for any input!

 

 

current code below:

 

DATA covs;
FORMAT treatment best12. d_daytime_9_16 best12. d_earlyfringe_16_20 best12. d_primetime_20_23 best12. d_latefringe_23_5 best12.
d_weekend best12. 
d_week14 best12. d_week15 best12. d_week16 best12. d_week17 best12. d_week18 best12. d_week19 best12. d_week20 best12.
d_week21 best12. d_week22 best12. d_week23 best12. d_week24 best12. d_week25 best12. d_week26 best12.;
INPUT treatment d_daytime_9_16 d_earlyfringe_16_20 d_primetime_20_23 d_latefringe_23_5
d_weekend 
d_week14 d_week15 d_week16 d_week17 d_week18 d_week19 d_week20 d_week21 d_week22 d_week23 d_week24 d_week25 d_week26
;
DATALINES;
0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
1 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
;
RUN;

 

ods graphics on;
PROC PHREG DATA=metrics_v4 PLOTS(overlay range=0,10080)=(survival cumhaz);
CLASS advertisement treatment(ref="0") visit(ref="0")
d_daytime_9_16(ref="0") d_earlyfringe_16_20(ref="0") d_primetime_20_23(ref="0") d_latefringe_23_5(ref="0")
d_weekend(ref="0") 
d_week14(ref="0") d_week15(ref="0") d_week16(ref="0") d_week17(ref="0") d_week18(ref="0") d_week19(ref="0") d_week20(ref="0") d_week21(ref="0") d_week22(ref="0") d_week23(ref="0") d_week24(ref="0") d_week25(ref="0") d_week26(ref="0")
;
MODEL survivaltime*visit(0) = treatment 
d_daytime_9_16 d_earlyfringe_16_20 d_primetime_20_23 d_latefringe_23_5
d_weekend 
d_week14 d_week15 d_week16 d_week17 d_week18 d_week19 d_week20 d_week21 d_week22 d_week23 d_week24 d_week25 d_week26
;
BASELINE COVARIATES=covs OUT=base SURVIVAL=surv CUMHAZ=cumhaz / ROWID=treatment;
RUN;

 

DATA test_haz;
SET base;
haz = cumhaz - lag(cumhaz);
if cumhaz=0 then haz = .;
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!

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
  • 0 replies
  • 447 views
  • 0 likes
  • 1 in conversation