Hi !!

I am a cardiologist studying the influence of some environment variables on the number of deaths.

I am trying to perform time-stratified case-crossover design using a conditional logistic regression. I have found the commands to do it from this data matrix (A):

gen month=month(date)
gen year=year(date)
gen dow=dow(date)
egen stratum_YMD=group(year month dow)
sort stratum date
gen one=1 // convenience variable
by stratum: gen origdos=sum(one) // numbers days in strata 1-4 or 1-5
by stratum: egen n_in_stratum = max(origdos)
expand n_in_stratum
sort stratum origdos
by stratum origdos: gen dos=sum(one) // distribute duplicated days across case-ref sets
gen caseday=(dos==origdos) // set indicator for case day
egen ccset=group(year month dow dos) , label

* WEIGHT OBSERVATIONS BY N OF DEATHS ON INDEX DAY
gen tempweight=_Number_of_Deaths*caseday
egen weight=max(tempweight), by(ccset)
drop if weight==0

* CLOGIT ANALYSIS
clogit caseday PM10 [fweight=weight], group(ccset)

I found this code from: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4280686:

But, I would like to know the influence of these environment variables stratifying by some individual variables like sex. So, my data matrix is (B) where death is only 0 or 1 and when Id, sex etc are missing is because this day no patient died (death=0).

So, how can I perform a case-crossover design using a conditional logistic regression without transforming it into the previous data matrix (A) so I can calculate the conditional OR stratified by individual variables like sex????

Please help, !!

Thank you very much