* Required macros: 'ratio', 'c_ratio', 's_ratio'; data workloss ; input company $ employee hourslastyr hoursthisyr @@ ; cards ; A 1 12 13 A 2 24 25 A 3 15 15 A 4 30 32 A 5 32 36 A 6 26 24 A 7 10 12 A 8 15 16 A 9 0 2 A 10 14 12 B 1 10 8 B 2 8 0 B 3 0 4 B 4 14 6 B 5 12 10 B 6 6 0 B 7 4 2 B 8 0 4 B 9 8 4 B 10 16 8 ; data stratinfo ; input company $ totlastyr popsize ; cards ; A 16300 1000 B 12800 1500 ; * this calculates the separate ratio estimator ; %s_ratio(sample=workloss, setup=stratinfo, strata=company, param=mean, x=hourslastyr, response=hoursthisyr, tau_x=totlastyr, npop=popsize) ; * this calculates the combined ratio estimator ; %c_ratio(sample=workloss, setup=stratinfo, strata=company, param=mean, x=hourslastyr, response=hoursthisyr, tau_x=totlastyr, npop=popsize) ; data companya ; set workloss ; if company = 'A' ; data companyb ; set workloss ; if company = 'B' ; * here we use the ratio estimator separately by company to see if they differ. If so, the separate ratio estmator may be better ; %ratio(sample=companya,x=hourslastyr,response=hoursthisyr,tau_x=16300, param=mean,npop=1000) ; %ratio(sample=companyb,x=hourslastyr,response=hoursthisyr,tau_x=12800, param=mean,npop=1500) ;