/*Data download site: https://www.cdc.gov/nchs/data_access/Vitalstatsonline.htm*/ /*Documentation for data are located here: https://www.cdc.gov/nchs/nvss/mortality_public_use_data.htm */ /*Data Release Policy for Vital Statistics Micro-data Files https://www.cdc.gov/nchs/nvss/dvs_data_release.htm*/ ********************************************************************* NOTE: filename for 2020 was VS20MORT.DUSMCPUB_r20220104 NOTE: filename for 2021 was mort2021us.txt ********************************************************************* ; ************************************************************* ************************************************************* ************************************************************* *Be patient, this may take 1/2 hour or more to read data; ************************************************************* ************************************************************* ************************************************************* options formdlim=* linesize=150; %include 'MYFILE\PublicUseData\FORMATS_NCHS.SAS';/*NEED TO DOWNLOAD FROM NOMS ANALYST WEBSITE TOO; OR DELETE THIS LINE IF YOU DONT WANT FORMATS*/ libname pub2020 'MYFILE\PublicUseData\2020'; libname pub2021 'MYFILE\PublicUseData\2021'; %let year=2021; *for 2021 data; data public&year; infile 'MYFILE\PublicUseData\2021\mort2021us.txt' pad end=last; *for 2020 data; /*data public2020;*/ /*infile 'MYFILE\PublicUseData\2020\VS20MORT.DUSMCPUB_r20220104' pad end=last;*/ input @20 Resident_Status_US $1. /*@61 Education_1989 $2. This variable was discontinued in 2021*/ @63 Education_2003 $1. @64 Education_flag $1. @65 Month_of_Death $2. @69 Sex $1. @70 DetailAge $4. @74 Age_Substitution_Flag $1. @75 Age_Recode_52 $2. @77 Age_Recode_27 $2. @79 Age_Recode_12 $2. @81 Infant_Age_Recode_22 $2. @83 Place_of_Death_andStatus $1. @84 Marital_Status $1. @85 Day_of_Week_of_Death $1. @102 Current_Data_Year $4. @106 Injury_at_Work $1. @107 Manner_of_Death $1. @108 Method_of_Disposition $1. @109 Autopsy $1. @144 Activity_Code $1. @145 Place_of_Injury $1. @146 UNDERLYING_CAUSE_OF_DEATH $4. @150 Cause_Recode_358 $3. @154 Cause_Recode_113 $3. @157 Infant_Cause_Recode_130 $3. @160 Cause_Recode_39 $2. @163 Number_Entity_Axis_Conditions $2. @165 Condition_1EA $7. @172 Condition_2EA $7. @179 Condition_3EA $7. @186 Condition_4EA $7. @193 Condition_5EA $7. @200 Condition_6EA $7. @207 Condition_7EA $7. @214 Condition_8EA $7. @221 Condition_9EA $7. @228 Condition_10EA $7. @235 Condition_11EA $7. @242 Condition_12EA $7. @249 Condition_13EA $7. @256 Condition_14EA $7. @263 Condition_15EA $7. @270 Condition_16EA $7. @277 Condition_17EA $7. @284 Condition_18EA $7. @291 Condition_19EA $7. @298 Condition_20EA $7. @341 Number_Record_Axis_Conditions $2. /*see documentation on how maternal deaths are coded*/ @344 Condition_1RA $5. @349 Condition_2RA $5. @354 Condition_3RA $5. @359 Condition_4RA $5. @364 Condition_5RA $5. @369 Condition_6RA $5. @374 Condition_7RA $5. @379 Condition_8RA $5. @384 Condition_9RA $5. @389 Condition_10RA $5. @394 Condition_11RA $5. @399 Condition_12RA $5. @404 Condition_13RA $5. @409 Condition_14RA $5. @414 Condition_15RA $5. @419 Condition_16RA $5. @424 Condition_17RA $5. @429 Condition_18RA $5. @434 Condition_19RA $5. @439 Condition_20RA $5. /*@445 Race_US_Occurrence $2. This variable was discontinued in 2021*/ /*@447 Bridged_Race_Flag $1. This variable was discontinued in 2021*/ @448 Race_Imputation_Flag $1. /*@449 Race_Recode_3 $1. This variable was discontinued in 2021*/ /*@450 Race_Recode_5 $1. This variable was discontinued in 2021*/ @484 Hispanic_Origin $3. /*@488 HispanicOrigin9_RaceRecode $1. This variable was discontinued in 2021*/ @489 RaceRecode_40 $2. @806 CensusOcc $4. @810 Occ_26 $2. @812 CensusInd $4. @816 Ind_23 $2. ; run; /* *The next part of the program is to create a tempory dataset restricted to: 1) >15 years of age, with age not missing, 2) those who RESIDED in the US, and 3) those jurisdictions that were part of the Occupation and Industry Coding program (2020 Not:AZ,IA,NC,RI,DC; 2021 Not: RI, DC). *People who are from included jurisdictions may have individual records that do not have enough information to have census codes. *These will have CDC Census codes that can be found here: https://www.cdc.gov/niosh/topics/coding/docs/tables/nonpaid.html ; *Or for those whose usual occupation was in the military you can find codes for those here: https://www.cdc.gov/niosh/topics/coding/docs/tables/military.html * or visit this page for more information: https://www.cdc.gov/niosh/topics/coding/more.html for more information.; ; */ data a; set public&year; where (Age_Recode_12 not in ("01", "02", "03", "12")) and (Resident_Status_US ne ("4")) AND (CensusOcc ne ("")); run; *To create a temporary dataset named B with a recoded ethnicity & Race/Ethnicity variable and format variables; DATA b; SET a; length UCOD39_C19 $2; if (100<=(input(Hispanic_Origin,3.))<=199) then Hispanic_Origin_R=1; else if (200<=(input(Hispanic_Origin,3.))<=209) then Hispanic_Origin_R=2; else if (210<=(input(Hispanic_Origin,3.)) <=219) then Hispanic_Origin_R=3; else if (input(Hispanic_Origin,3.)) =220 then Hispanic_Origin_R=4; else if (221<=(input(Hispanic_Origin,3.)) <=230) then Hispanic_Origin_R=5; else if (231<=(input(Hispanic_Origin,3.)) <=249) then Hispanic_Origin_R=6; else if (250<=(input(Hispanic_Origin,3.)) <=259) then Hispanic_Origin_R=7; else if (260<=(input(Hispanic_Origin,3.)) <=269) then Hispanic_Origin_R=8; else if (270<=(input(Hispanic_Origin,3.)) <=274) then Hispanic_Origin_R=9; else if (275<=(input(Hispanic_Origin,3.)) <=279) then Hispanic_Origin_R=10; else if (280<=(input(Hispanic_Origin,3.)) <=299) then Hispanic_Origin_R=11; else if (996<=(input(Hispanic_Origin,3.)) <=999) then Hispanic_Origin_R=12; else Hispanic_Origin_R=.; if Hispanic_origin in ("200", "202", "203", "204", "206", "208", "209", "210", "211", "212", "213", "214", "216", "217", "218", "220", "221", "222", "223", "224", "225", "226", "227", "228", "231", "232", "233", "234", "235", "236", "237", "238", "239", "240", "242", "250", "251", "252", "260", "261", "270", "271", "275", "280", "281", "282", "283", "284", "286", "287", "289", "299") then raceeth=1;/*Hispanic*/ else if RaceRecode_40 in ("03") then raceeth=2;/*Non-Hispanic American Indian or Alaskan Native*/ else if RaceRecode_40 in ("04", "05", "06", "07", "08", "09", "10") then raceeth=3;/*Non-Hispanic Asian*/ else if RaceRecode_40 in ("02") then raceeth=4;/*Non-Hispanic Black*/ else if RaceRecode_40 in ("15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40") then raceeth=5;/*Non-Hispanic Multiple Race*/ else if RaceRecode_40 in ("11", "12", "13", "14") then raceeth=6;/*Non-Hispanic Native Hawaiian or Other Pacific Islander*/ else if RaceRecode_40 in ("01") then raceeth=7;/*Non-Hispanic White*/ /*Creates a new variable with NCHS's 39 cause recode but with COVID-19 as a separate category*/ if UNDERLYING_CAUSE_OF_DEATH in ('U071') then UCOD39_C19 ="45"; else UCOD39_C19=Cause_Recode_39; *********************************************************************************************************; *********************************************************************************************************; *********************************************************************************************************; *********************************************************************************************************; * can move this up if you want to just run the first part of the program and want formats OR DELETE IF YOU DONT WANT FORMATS; format RESIDENT_STATUS_US $RESIDENT_STATUS_US. /*EDUCATION_1989 $EDUCATION_1989N. This variable was discontinued in 2021*/ EDUCATION_2003 $EDUCATION_2003N. EDUCATION_FLAG $EDUCATION_FLAG. MONTH_OF_DEATH $MONTH_OF_DEATH. SEX $SEX. AGE_SUBSTITUTION_FLAG $AGE_SUBSTITUTION_FLAG. AGE_RECODE_12 $AGE_RECODE_12N. AGE_RECODE_27 $AGE_RECODE_27N. AGE_RECODE_52 $AGE_RECODE_52N. INFANT_AGE_RECODE_22 $INFANT_AGE_RECODE_22N. PLACE_OF_DEATH_ANDSTATUS $PLACE_OF_DEATH_ANDSTATUS. MARITAL_STATUS $MARITAL_STATUS. DAY_OF_WEEK_OF_DEATH $DAY_OF_WEEK_OF_DEATH. INJURY_AT_WORK $INJURY_AT_WORK. MANNER_OF_DEATH $MANNER_OF_DEATH. METHOD_OF_DISPOSITION $METHOD_OF_DISPOSITION. AUTOPSY $AUTOPSY. ACTIVITY_CODE $ACTIVITY_CODE. PLACE_OF_INJURY $PLACE_OF_INJURY. /*CAUSE_RECODE_358 CAUSE358R.*//*no formats created for this variable*/ /*CAUSE_RECODE_113 CAUSE113R.*//*no formats created for this variable*/ Cause_Recode_39 $NCHS39S./*ABREVIATED FORMATS. CAN USE $NCHS39L FOR FULL TITLE*/ UCOD39_C19 Cause_Recode_39 $NCHS39S. /*RACE_US_OCCURRENCE $RACE_US_OCCURRENCE. *This variable was discontinued in 2021*/ /*BRIDGED_RACE_FLAG $BRIDGED_RACE_FLAG. *This variable was discontinued in 2021 */ RACE_IMPUTATION_FLAG $RACE_IMPUTATION_FLAG. /*RACE_RECODE_3 $RACE_RECODE_3N. This variable was discontinued in 2021*/ /*RACE_RECODE_5 $RACE_RECODE_5N. *This variable was discontinued in 2021*/ HISPANIC_ORIGIN $HISPANIC_ORIGIN. HISPANIC_ORIGIN_R HISPANIC_ORIGIN_R. /*HISPANICORIGIN9_RACERECODE $HISPANICORIGIN_RACERECODE. *This variable was discontinued in 2021*/ RaceRecode_40 $MRACREC. CENSUSOCC $CENSUSOCC. OCC_26 $OCCRECODE. CENSUSIND $CENSUSIND. IND_23 $INDRECODE. RaceETH RACEETH. ; *********************************************************************************************************; *********************************************************************************************************; *********************************************************************************************************; *********************************************************************************************************; run; proc contents data=B; run; title "Control Table 1. Usual Occupation by Census and Supplementary Occupation Codes and Titles &year"; proc freq data=B; tables censusOcc/nocum; run; title "Control Table 2. Usual Industry by Census and Supplementary Industry Codes and Titles &year"; proc freq data=B; tables censusIND/nocum; run; title "Control Table 3. Usual Occupation by NHIS Simple Recodes and Sex &year"; proc freq data=B; tables Occ_26*sex /nocol nopercent; run; title "Control Table 4. Usual Occupation by NHIS Simple Recodes and Race and Ethnicity &year"; proc freq data=B; tables Occ_26*RACEETH /nocol nopercent; run; title "Control Table 5. Usual Occupation by NHIS Simple Recodes and Age Groups &year"; proc freq data=B; tables Occ_26*age_recode_12 /nocol nopercent; run; title "Control Table 8. Usual Industry by NHIS Simple Recodes and Sex &year"; proc freq data=B; tables Ind_23*sex/nocol nopercent; run; title "Control Table 9. Usual Industry by NHIS Simple Recodes and Race and Ethnicity &year"; proc freq data=B; tables Ind_23*RACEETH/nocol nopercent; run; title "Control Table 10. Usual Industry by NHIS Simple Recodes and Age Groups &year"; proc freq data=B; tables Ind_23*age_recode_12/nocol nopercent; run; title; *To create a permanent dataset ; /* data PUB&YEAR.public&year; set B; run; */