! GLIM4 macro implementing the semi=parametric self-controlled case series method ! for evaluating associations between vaccination and adverse events ! ! Version 1.0 5 July 2004 ! ! This macro requires data in the following form: ! var 1: IND_ individual number (in sequence; ties for multiple events) ! var 2: AGE_ age at event (order immaterial) ! var 3: STA_ unit before start of obs period for each indiv (>=-1) ! var 4: END_ end of obs period for each indiv (>=0) ! var 5: VC_ vector of length %v containing the vaccine codes ! vars 6 to 6+%v-1 : %v sorted vaccine cutpoints (can be tied) ! vars 6+%v to 6+%v+%c-1 : stratifying covariates ! All cutpoints correspond to upper interval limits. ! The %v vaccine cutpoints, sequentially ! ordered, together with the covariates are entered into two lists which ! constitute the two arguments of the macro, in the order vac_list then cov_list. ! ! A model macro must also be defined; the factors available are: ! I_: individual, eliminated from the fit ! T_: support points for the EDF ! V_: vaccine risk groups ! C_1...C_m: fixed covariate factors ! $macro clus! $list L_=%1$ $cal %z1=%a2+1$ $arg set %1 %2$ $switch %z1 noset set$ $sort OAGE_ AGE_$ $sort LAGE_ OAGE_ -2$ $cal DIST_=(OAGE_/=LAGE_)$ $pick OAGE_ DIST_$ $cal %a=%len(OAGE_)$ !a: total number of distinct age points $cal %v=%len(%1)$ !v: number of vaccine groups $cal %m=%len(K_)$ !m: number of fixed covariates $tab the IND_ l into %t$ !t: total number of individuals $cal %n=%t*%a$ !n: total size of problem $tab the VC_ l into %p !p: number of vaccine risk levels $slength %n$ $var %n N_ I_ W_ T_ V_$ $list %m C_$ $cal N_=0:I_=0:W_=0:T_=0:V_=0$ $cal %i=1:%j=1:%k=1$ !i: indiv; j: record; k: time point $cal %z1=1$while %z1 ind$ $use mfac$ $del Z_$ $use modl$ $del LAGE_ DIST_$ $$endmac ! $macro noset! Defines K_ as null list if no covariates declared $list 0 K_$ $$endmac$ ! $macro set! Defines K_ as second argument if present $list K_=%2$ $$endmac$ ! $macro ind! sets up the vectors for individual i $var 1 TMP1_$ $var %a IN_ TIM_ WT_ VAC_ NUM_ TMP2_$ $cal IN_=%i$ $cal TIM_=%cu(1)$ $cal VAC_=0:WT_=0:NUM_=0:TMP2_=0$ $cal %z1=%a:%z2=0$ $while %z1 hist$ $cal %c=%cu((IND_==%i))$ !c: total number of cases for individual i $cal %z1=1:%z2=%j$ $cal TMP2_=0$ $while %z1 case$ $cal NUM_=TMP2_$ $cal %z1=1:%z2=%k:%z3=1$ $cal %z4=1:%z5=(%z4<=%m)$ $while %z1 vars$ $cal %i=%i+1:%j=%j+%c:%k=%k+%a$ $cal %z1=(%i<=%t)$ $del IN_ TIM_ WT_ VAC_ NUM_ TMP1_ TMP2_$ $$endmac ! $macro hist! Sets up the weights and the vac indicator $cal %z2=%z2+1:%z1=%z1-1$ $cal WT_(%z2)=(STA_(%j)