 select caseid, event_dt, sex, reporter_country, max(age) as default_age
 from all_casedemo 
 where caseid is not null and event_dt is not null and age is not null and sex is not null and reporter_country is not null
-group by caseid, event_dt, sex, reporter_country
+group by caseid, event_dt, sex, reporter_country;
 
 -- single imputation of missing age 
 update all_casedemo a 

create table casedemo as
select caseid, caseversion, i_f_code, event_dt, age, sex, reporter_country, d.primaryid, drugname_list, reac_pt_list, fda_dt
from demo d
inner join drugname_list dl
on d.primaryid = dl.primaryid 
inner join reac_pt_list rpl
on d.primaryid = rpl.primaryid;

----------------------

select caseid, age, sex, reporter_country, max(event_dt) as default_event_dt
from all_casedemo 
where caseid is not null and event_dt is not null and age is not null and sex is not null and reporter_country is not null
group by caseid, age, sex, reporter_country;

-- single imputation of missing event_dt 
update all_casedemo a
