/*************************************************************** --> Stata commands to calculate SIR-values with 95% --> confidence intervals for several occupations combined ***************************************************************/ * Stata clear set more off /*************************************************************** --> Reading data from internet ***************************************************************/ local f "astra.cancer.fi/NOCCA/Incidence/Results/All-tables.csv" insheet using http://`f', delim(";") names clear /************************************************************** --> User can select the occupations to combine by changing --> the inlist statement below. Example shows how to --> combine male farmers and gardeners, and tabulation --> of the combined results by cancer site. List of occupational --> categories are given at the end of this file. ***************************************************************/ keep if gender == "Men" /* Men, Women */ keep if inlist( occno , 16 ,17) /* 1-54*/ /************************************************************** --> Summarising obs and exp for each country by cancer site. --> Calculating SIRs and 95% confidence intervals ***************************************************************/ collapse (sum) *obs *exp (first) siteno , by(sitetext) qui foreach c in den fin swe nor ice tot { generate `c'SIR = `c'obs / `c'exp generate `c'_SIR_lb = . generate `c'_SIR_ub = . forvalues i = 1/`=_N' { local `c'OBS = `c'obs[`i'] iri ``c'OBS' 100000 1 100000 /* get exact poisson limits */ replace `c'_SIR_lb = `r(lb_irr)' / `c'exp if _n == `i' replace `c'_SIR_ub = `r(ub_irr)' / `c'exp if _n == `i' } } /************************************************************** --> Formatting, sorting, and some examples of tabulation **************************************************************/ format %3.2f *SIR* format %3.1f *exp* format %-42s sitetext sort siteno list siteno sitetext tot* , noobs compress list siteno sitetext fin* , noobs compress qui{ /************************************************************** --> List of occupational categories *************************************************************** 1 Technical workers, etc 2 Laboratory assistants 3 Physicians 4 Dentists 5 Nurses 6 Assistant nurses 7 Other health workers 8 Teachers 9 Religious workers etc 10 Artistic workers 11 Journalists 12 Administrators 13 Clerical workers 14 Sales agents 15 Shop workers 16 Farmers 17 Gardeners 18 Fishermen 19 Forestry workers 20 Miners and quarry workers 21 Seamen 22 Transport workers 23 Drivers 24 Postal workers 25 Textile workers 26 Shoe and leather workers 27 Smelting workers 28 Mechanics 29 Plumbers 30 Welders 31 Electrical workers 32 Wood workers 33 Painters 34 Other construction workers 35 Bricklayers 36 Printers 37 Chemical process workers 38 Food workers 39 Beverage workers 40 Tobacco workers 41 Glass makers etc 42 Packers 43 Engine operators 44 Public safety workers 45 Cooks and stewards 46 Domestic assistants 47 Waiters 48 Building caretakers 49 Chimney sweeps 50 Hairdressers 51 Launderers 52 Military personnel 53 Other workers 54 Economically inactive **************************************************************** --> End Stata do-file ***************************************************************/ }