/********************************************************************** * PGM NAME: Comp_gest_old_fmt.sas * * (CD ROM sending to States who use old format of birth certificate * * NOTE: * * 1. This program is for OLD FORMAT BIRTH CERTIFIACTE data * * 2. This programm is for creating a SAS data set from a text file * * created and maintained by State to edit the natality computed * * gestation(comp_gest) and combined gestation(comb_gest). * * 3. processing two variables: * * COMP_GEST--gestation computed based on LMP * * COMB_GEST--combined gestation based on the computed gestation * * or clinical estimate gestation (clinest) described * * in Instruction Manual Part 12 * * Computer Edits for Natality Data, Effective 1993 * * DATE : 06/25/2004 * * PROGRAMMER: JIAQUAN XU * * SOFTWARE: SAS 8.02 * * ORGNIZATION: DVS/NCHS/CDC * **********************************************************************/ /* test data for Georgia, year 2004, old format of birth certificate */ LIBNAME NAT 'H:\_Z'; * where the SAS data set stored; FILENAME READIN 'H:\_Z\2005\nat\final\de05902s.nat'; * path for CA 2003 text file; *FILENAME READIN 'c:\nat_file_gest\yc03001s.nat'; * path for YC 2003 text file; *FILENAME READIN 'c:\nat_file_gest\hi03001s.nat'; * path for HI text file; *FILENAME READIN 'c:\nat_file_gest\az03001s.nat'; * path for AZ text file; *FILENAME READIN 'c:\nat_file_gest\nj03001s.nat'; * path for NJ text file; *FILENAME READIN 'c:\nat_file_gest\la03002s.nat'; * path for LA text file; *FILENAME READIN 'c:\nat_file_gest\md03011s.nat'; * path for MD text file; *FILENAME READIN 'c:\nat_file_gest\nc04001s.nat'; * path for NC text file; *FILENAME READIN 'c:\nat_file_gest\oh04001s.nat'; * path for OH text file; *FILENAME READIN 'c:\nat_file_gedt\ca04001s.nat'; * path for CA 2004 text file; *FILENAME READIN 'c:\nat_file_gest\il04001s.nat'; * path for IL text file; *FILENAME READIN 'c:\nat_file_gest\fl04003s.nat'; * path for FL text file; *FILENAME READIN 'c:\nat_file_gest\tx04001s.nat'; * path for TX text file; *FILENAME READIN 'c:\nat_file_gest\ak03006s.nat'; * path for AK text file; *FILENAME READIN 'c:\nat_file_gest\ga03001s.nat'; * path for GA text file; *FILENAME READIN 'c:\nat_file_gest\ga04001s.nat'; * path for GA text file; *FILENAME READIN 'c:\nat_file_gest\ky03001s.nat'; * path for KY text file; %GLOBAL ST YR STE year; * create a global macro variables used in title; %let STE = de; * change the State name here; %let year = 2005; * this is the data year, change it accordingly; /*************************************************************************************** * !!!!!! Variable Name Convention !!!!!! * * * * CERT: Certificate Number DOB_MM: Child Birth Month * * DOB_DD: Child Birth Date STATE: State * * HISPM: Hispanic Orign of Mother HISPF: Hispanic Origin of Father * * RACEM: Mother's Race RACEF: Father's Race * * LMP_MM: Month of Last Normal Menses LMP_DD: Date of Last Normal Menses * * BWT: Child Birth Weight CLINEST: Obstetric Estimation of Gestation * * PLUR: Plurality DOB_YY: Child Birth Year * * LMP_YY: Year of Last Normal Menses UBWT: Birth Weight Unit * * FRACE: Father's race recode MRACE: Mother's race recode * * LMP_CENT: LMP century month DOB_CENT: DOB century month * * WT: Birth weight recode OBWT: Birth weight used in PGM * * GESTMTH: Gestation month MBRACE: Mother's bridged race * * MHISPC: Mother's Hispanic origin FHISPC: Father's Hispanic origin * * * * COMP_GEST: Computed Gestation COMB_GEST:Combined Gestation * * * * MAXWKS: Max. possible gestation wks MINWKS: min. possible gestation wks * * PRE_DOB_MM:Birth month of previous record with valid value * * FBRACE: Father's bridged race * * PRE_RACE: Mother's race of previous record with valid race * * PRE_RACEN: Mother bridged race of previous record with valid bridged race * * COMPGESTok:Computed gestation consistency check value * * OBGESTok: Obstetric Gestation consistency check value * * CLINEST: Obstetric Estimation of Gestation * * MRACEHISP: Mother's Hispanic origin recode * * FRACEHISP: Father's Hispanic origin recode * * * ***************************************************************************************/ DATA NAT.GEST_&STE (DROP=HOLDBWT HOLDLMP_YY HOLDDOB_YY HOLDLMP_MM HOLDDOB_MM HOLDDOB_DD HOLDLMP_DD); * read in data from text file; LENGTH HOLDBWT HOLDLMP_YY HOLDDOB_YY $ 8 HOLDLMP_MM HOLDDOB_MM HOLDDOB_DD HOLDLMP_DD $ 4; INFILE READIN LRECL = 1000; INPUT CERT $ 3-8 DOB_MM $ 9-10 DOB_DD $ 11-12 STATE $ 16-17 HISPM $ 42 HISPF $ 43 RACEM $ 44 RACEF $ 45 LMP_MM $ 61-62 LMP_DD $ 63-64 UBWT $ 71 BWT $ 72-75 CLINEST $ 76-77 PLUR $ 78 DOB_YY $ 224-227 LMP_YY $ 236-239 B_STATE $ 256-257 MHISPC $ 883-885 FHISPC $ 889-891 MBRACE $ 895-896 FBRACE $ 897-898; HOLDBWT = '0000' || BWT; * add zero(s) in front of the number if necessary; BWT = SUBSTR(RIGHT(HOLDBWT), 5); IF CERT <= '000000' | CERT > = '999999' THEN DO; CERT_ER = 1; END; HOLDLMP_YY ='0000' || LMP_YY; LMP_YY = SUBSTR(RIGHT(HOLDLMP_YY),5); HOLDDOB_YY ='0000' || DOB_YY; DOB_YY = SUBSTR(RIGHT(HOLDDOB_YY),5); HOLDLMP_MM ='00' || LMP_MM; LMP_MM = SUBSTR(RIGHT(HOLDLMP_MM),3); HOLDDOB_MM ='00' || DOB_MM; DOB_MM = SUBSTR(RIGHT(HOLDDOB_MM),3); HOLDLMP_DD ='00' || LMP_DD; LMP_DD = SUBSTR(RIGHT(HOLDLMP_DD),3); HOLDDOB_DD ='00' || DOB_DD; DOB_DD = SUBSTR(RIGHT(HOLDDOB_DD),3); RUN; PROC SORT DATA=NAT.GEST_&ste nodup; BY CERT; RUN; DATA NAT.MATRIX; /* Assign the value from previous year cases with complete reporting date of LMP to the matrix. The matrix will change as processing proceeds to reflect the last record with complete reporting of data of LMP, birth weight, and hispanic origin */ /*****Non_Hispanic White*****/ ARRAY NHWHITE(0:10, 5:10)WM1-WM66 /*<6 6 7 8 9 10+ gestation month*/ (20 21 24 28 33 39 /* <500 */ 18 23 29 31 34 38 /* 500 - 999 */ 18 22 26 32 38 39 /* 1000 - 1499 */ 18 21 27 31 38 40 /* 1500 - 1999 */ 18 23 25 30 34 40 /* 2000 - 2499 */ 18 23 28 33 35 39 /* 2500 - 2999 */ 18 23 27 32 38 39 /* 3000 - 3499 */ 17 17 24 34 38 39 /* 3500 - 3999 */ 19 23 27 30 34 39 /* 4000 - 4499 */ 17 21 26 31 36 39 /* 4500 - 4999 */ 18 23 27 31 38 40); /* >= 5000 */ /*****Non_Hispanic Black*****/ ARRAY NHBLACK(0:10, 5:10)BM1-BM66 /*<6 6 7 8 9 10+ gestation month*/ (18 23 26 29 33 39 /* <500 */ 19 22 26 33 35 39 /* 500 - 999 */ 17 22 26 31 38 39 /* 1000 - 1499 */ 18 21 25 32 38 40 /* 1500 - 1999 */ 19 21 28 30 34 38 /* 2000 - 2499 */ 19 22 26 31 37 39 /* 2500 - 2999 */ 17 22 27 34 38 39 /* 3000 - 3499 */ 20 21 24 29 34 40 /* 3500 - 3999 */ 18 23 27 31 34 39 /* 4000 - 4499 */ 17 22 26 31 37 39 /* 4500 - 4999 */ 19 21 27 33 36 40); /* >= 5000 */ /*****Non_Hispanic Other*****/ ARRAY NHOTHER(0:10, 5:10)OM1-OM66 /*<6 6 7 8 9 10+ gstation month*/ (20 23 28 30 34 39 /* <500 */ 17 21 27 32 37 39 /* 500 - 999 */ 17 23 26 31 38 40 /* 1000 - 1499 */ 19 21 23 31 36 39 /* 1500 - 1999 */ 17 20 29 32 35 39 /* 2000 - 2499 */ 19 21 27 31 38 39 /* 2500 - 2999 */ 17 21 27 32 38 40 /* 3000 - 3499 */ 18 23 26 29 33 39 /* 3500 - 3999 */ 18 23 26 32 35 39 /* 4000 - 4499 */ 18 23 26 31 38 39 /* 4500 - 4999 */ 17 23 25 29 37 40); /* >= 5000 */ /***** Hispanic *****/ ARRAY HISP(0:10, 5:10)HM1-HM66 /*<6 6 7 8 9 10+ gestation month*/ (20 21 24 28 33 39 /* <500 */ 18 23 29 31 34 38 /* 500 - 999 */ 18 22 26 32 38 39 /* 1000 - 1499 */ 18 21 27 31 38 40 /* 1500 - 1999 */ 18 23 25 30 34 40 /* 2000 - 2499 */ 18 23 28 33 35 39 /* 2500 - 2999 */ 18 23 27 32 38 39 /* 3000 - 3499 */ 17 17 24 34 38 39 /* 3500 - 3999 */ 19 23 27 30 34 39 /* 4000 - 4499 */ 17 21 26 31 36 39 /* 4500 - 4999 */ 18 23 27 31 38 40); /* >= 5000 */ RUN; DATA NAT.GEST&STE (KEEP = CERT LMP_YY DOB_YY FRACE MINWKS COMPGESTok OBGESTok BWT LMP_MM STATE HISPM UBWT PRE_DOB_MM COMP_GEST PLUR LMP_DD HISPF LMP_CENT COMB_GEST RACEHISP WT DOB_MM RACEF RACEM DOB_CENT FRACEHISP PRE_RACE OBWT DOB_DD MRACE MAXWKS CLINEST MRACEHISP GESTMTH MHISPC FHISPC MBRACE FBRACE CERT_ER PRE_RACEN INTDAY CALCDAY LMPLeap DOBLeap POB_YY POBLeap) NAT.MATRIX(KEEP = WM1-WM66 BM1-BM66 OM1-OM66 HM1-HM66); /* hotdeck */ RETAIN PRE_DOB_MM PRE_RACE PRE_RACEN; LENGTH COMP_GEST 3 COMB_GEST 3; SET NAT.GEST_&STE END=EOF; IF _N_ = 1 THEN DO; SET NAT.MATRIX; * make the matrix available for all observations; CALL SYMPUT('ST', LEFT(TRIM(STATE))); * macro used in title; CALL SYMPUT('YR', LEFT(TRIM(DOB_YY))); * data year used in title; PRE_DOB_MM = '01'; * initializing month of birth; PRE_RACE = '1'; * initializing race of mother; PRE_RACEn = '01'; * initializing bridge race of mother; END; /*Assign the values from the matrix to arrays based on the hispanic origin, gestation month and birth weight*/ ARRAY NHWHITE(0:10, 5:10)WM1-WM66; ARRAY NHBLACK(0:10, 5:10)BM1-BM66; ARRAY NHOTHER(0:10, 5:10)OM1-OM66; ARRAY HISP (0:10, 5:10)HM1-HM66; /**** Date of Birth processing(Infant) ****/ /*p2 Date of Birth: */ /*B.1. Month of Birth */ /*If the natality detail record is not coded 01-12, the code from the preceding record is inserted */ IF DOB_MM < '01' | DOB_MM > '12' THEN DOB_MM = PRE_DOB_MM; ELSE PRE_DOB_MM = DOB_MM; /* p2 B.2.1 Day of Birth : */ /* If the day is not within the range of 01-31 or is 99, change to 15 */ IF DOB_DD < '01' | DOB_DD > '31' | DOB_DD = '99' THEN DOB_DD = '15'; /*p2 B.2.2 The day of birth must fall within the correct range for the month (e.g. month 04,days 01-30). If not, change code for day to last permissible day of month. For example, if month is 04 and day is 31, change day code to 30 */ IF DOB_MM = '02' THEN DO; IF MOD(INPUT(SUBSTR(DOB_YY, 3), 2.), 4) = 0 THEN DO; IF DOB_DD > '29' THEN DOB_DD = '29'; * leap year; END; ELSE DO; IF DOB_DD > '28' THEN DOB_DD = '28'; * regular year; END; END; ELSE IF DOB_MM IN ('04' '06' '09' '11') THEN DO; * the months with 30 days; IF DOB_DD > '30' THEN DOB_DD = '30'; END; /* p31 */ /* Birthweight Processing: Coded in grams-edit detail entry for a range of 0227-8165 and if entry is outside this range or unknown, change code to 9999 */ IF UBWT = '9' THEN BWT = '9999'; * birth weight not classifiable; IF UBWT = '2' & BWT ^= '9999' THEN DO; * convert weight in pounds and ounces to grams; IF SUBSTR(BWT, 3) = '99' THEN SUBSTR(BWT, 3) = '00'; * assign ounce value 99 to zero; IF SUBSTR(BWT, 1, 2) = '00' & '01' <= SUBSTR(BWT, 3) <= '98' THEN DO; OUNCE = INPUT(SUBSTR(BWT, 3), 2.); BWT = PUT(ROUND(28.35 * OUNCE), 4.); END; ELSE IF '01' <= SUBSTR(BWT, 1, 2) <= '18' & '00' <= SUBSTR(BWT, 3) <= '16' THEN DO; POUND = INPUT(SUBSTR(BWT, 1, 2), 2.); OUNCE = INPUT(SUBSTR(BWT, 3), 2.); BWT = PUT(ROUND(28.35 * (POUND * 16 + OUNCE)), 4.); END; ELSE BWT = '9999'; * add zero(s) in front of the number if the number is less than 4 digits; HOLDBWT = '0000' || LEFT(BWT); BWT = SUBSTR(RIGHT(HOLDBWT), 5); END; oBWT = BWT; IF oBWT < '0227' | oBWT > '8165' THEN oBWT = '9999'; /* P37 */ * If plur not coded 1-5, change code to 1; IF PLUR < '1' | PLUR > '5' THEN PLUR = '1'; *p22 B.1.; /**** Last menstrual Period Edits *****/ /* If MONTH of last normal menses is not coded 01-12 or 99, change to 99 */ IF LMP_MM < '01' OR LMP_MM > '12' THEN LMP_MM = '99'; *p22 B.2.; /* If DAY is not 01-31 or 99, change code to 99. if day of month is know, day must fall within the correct range for month(e.g., month = 04, day = 01-30). If not, change it to the last valid day for month*/ IF LMP_DD < '01' OR LMP_DD > '31' THEN LMP_DD = '99'; IF LMP_MM = '02' THEN DO; IF MOD(INPUT(SUBSTR(LMP_YY, 3), 2.), 4) = 0 THEN DO; IF LMP_DD > '29' & LMP_DD ^= '99' THEN LMP_DD = '29'; * leap year; END; ELSE DO; IF LMP_DD > '28' & LMP_DD ^= '99' THEN LMP_DD = '28'; * regular year; END; END; IF LMP_MM IN('04' '06' '09' '11') THEN DO; * the months with 30 days; IF LMP_DD > '30' & LMP_DD ^= '99' THEN LMP_DD = '30'; END; /* p22 B.3.*/ /* If YEAR of last nomal menses is not the same as or two year less than the year of birth, chage code to 9999 */ if DOB_YY ^= &year then DOB_YY = &year; DOBYY = INPUT(DOB_YY, 4.) - 2; DOB_YY_1 = PUT(DOBYY, 4.); IF LMP_YY < DOB_YY_1 | LMP_YY > DOB_YY THEN LMP_YY = '9999'; /*p23 B.4.*/ /* Period of gestation computaion */ /* Period of gestation is computed from date of birth and date of LMP. Each item must be edited for impossoble codes before gestation can be computed */ /*4.1. */ /* If month of last normal menses is coded 99, code gestation 99*/ IF LMP_MM = '99' THEN COMP_GEST = 99; /*4.2.*/ /* If year of last normal menses is code X, code gestation 99*/ IF LMP_YY = '9999' THEN COMP_GEST = 99; /*p23 B.5.*/ /* For records with complete date of LMP, comput period of gestation as follows: /* P23 5.1. */ *Determin interval in days between date of LMP and date of birth.; /*p30 5.1.1.*/ * Determine day of year of birth and day of year of LMP. Day of year of the event = starting day factor of month of event (see chart) plus day of month. For example, the day of year of an event occurring on August 9 = 221 (212 + 9) ____________________________________________________________________ Month name month code starting day factor ____________________________________________________________________ January 01 000 February 02 031 March 03 059 April 04 090 May 05 120 June 06 151 July 07 181 August 08 212 September 09 243 October 10 273 November 11 304 December 12 334 ____________________________________________________________________*/ * POBYY = DOB_YY - 1; POB_YY = DOB_YY - 1; if(mod(POB_YY,4) = 0) then POBLeap = 1; else POBLeap = 0; put CERT DOB_YY POB_YY POBLeap; *p24 5.1.2. & 5.1.3. Interval in days = Day of year of birth minus day of year of LMP. If the data year is a Leap Year (Last 2 digits evenly divisible by 4) and month code of birth (see chart) is greater than 02, add 1 to calculated interval in days.; IF MOD(INPUT(SUBSTR(DOB_YY, 3), 2.), 4) = 0 THEN DO; * starting date factor for DOB leap year; M1 = 0; M2 = 31; M3 = 60; M4 = 91; M5 = 121; M6 = 152; M7 = 182; M8 = 213; M9 = 244; M10= 274; M11 = 305; M12 = 335; DOBLeap = 1; END; ELSE DO; * starting date factor for DOB regular year; M1 = 0; M2 = 31; M3 = 59; M4 = 90; M5 = 120; M6 = 151; M7 = 181; M8 = 212; M9 = 243; M10 = 273; M11= 304; M12= 334; DOBLeap = 0; END; IF LMP_YY ^= '9999' THEN DO; IF MOD(INPUT(SUBSTR(LMP_YY, 3),2.), 4) = 0 THEN DO; * starting date factor for LMP leap year; L1 = 0; L2 = 31; L3 = 60; L4 = 91; L5 = 121; L6 = 152; L7 = 182; L8 = 213; L9 = 244; L10= 274; L11 = 305; L12 = 335; LMPLeap = 1; END; ELSE DO; * starting date factor for LMP regular year; L1 = 0; L2 = 31; L3 = 59; L4 = 90; L5 = 120; L6 = 151; L7 = 181; L8 = 212; L9 = 243; L10 = 273; L11= 304; L12= 334; LMPLeap = 0; END; END; ARRAY S_D_F(12) M1-M12; ARRAY S_D_F_L(12) L1-L12; IF LMP_YY ^='9999' & LMP_MM ^= '99' & LMP_DD ^= '99' THEN DO; CALCDAY = (S_D_F(INPUT(DOB_MM, 2.)) + INPUT(DOB_DD, 2.)) - (S_D_F_L(INPUT(LMP_MM, 2.)) + INPUT(LMP_DD, 2.)); put cert CALCDAY; INTDAY = CALCDAY; * out of range; if( LMP_YY <= DOB_YY - 2 ) then INTDAY = 999; * leap year in LMP; else if(INTDAY < 0 & LMPLeap = 1 & DOBLeap = 0) then INTDAY = INTDAY + 366; * no leap year in lmp; else if(INTDAY < 0) then INTDAY = INTDAY + 365; /*P25 5.2 */ /* calculating interval in days between birth date and last normal menses. If interval in days is negtive add 365 days. This can occur if: Year of LMP is incorrectely given as the same as the year of birth and month code of LMP is greater than month code of birth*/ * IF LMP_YY < DOB_YY THEN INTDAY + 365; * for record dob_yy>lmp_yy; * IF INTDAY < 0 THEN INTDAY = INTDAY + 365; * for record dob_mm 47 THEN COMP_GEST= 99; END; /* p14 ****** Check Mother's RACE ******/ /* For the race and Hispanic origin, some states who use old format birth ertificate use new birth ceritficate coded values, such as California. In orer to fit all states who use old birth certificate whether use old coded values or new coded values for race and Hispanic origin, check RACEM first*/ IF RACEM = 'X' | RACEM = ' ' THEN DO; * racem is not valid, use mbrace and mhispc; /* p13 22. For New format certificate Mannual. If record is coded 15 or 99 impute mother's race as that of father's race if coded 1-14. Otherwise, impute race of mother of preceding record IF preceding record is coded 1-14. */ IF MBRACE = '15' | MBRACE = '99' THEN DO; /* impute from father's or pre_race */ IF '01' <= FBRACE <= '14' THEN MBRACE = FBRACE; ELSE MBRACE = PRE_RACEn; END; ELSE IF '01' <= MBRACE <= '14' THEN PRE_RACEn = MBRACE; IF FBRACE = '15' THEN FBRACE = '99'; /* recode race */ /* mother's race */ IF MBRACE = "01" THEN MRACE = '1'; /* white */ ELSE IF MBRACE = "02" THEN MRACE = '2'; /* black */ ELSE IF MBRACE = "03" THEN MRACE = '3'; /* american_indian */ ELSE IF "04" <= MBRACE <= "14" THEN MRACE = '4'; /* pacific_islander */ ELSE IF MBRACE = "21" THEN MRACE = '1'; /* white */ ELSE IF MBRACE = "22" THEN MRACE = '2'; /* black */ ELSE IF MBRACE = "23" THEN MRACE = '3'; /* american Indian */ ELSE IF MBRACE = "24" THEN MRACE = '4'; /* pacific Islander */ /* father's race */ IF FBRACE = "01" THEN FRACE = '1'; /* white */ ELSE IF FBRACE = "02" THEN FRACE = '2'; /* black */ ELSE IF FBRACE = "03" THEN FRACE = '3'; /* american indian */ ELSE IF "04" <= FBRACE <= "14" THEN FRACE = '4'; /* pacific_islander */ ELSE IF FBRACE = "21" THEN FRACE = '1'; /* white */ ELSE IF FBRACE = "22" THEN FRACE = '2'; /* black */ ELSE IF FBRACE = "23" THEN FRACE = '3'; /* american indian */ ELSE IF FBRACE = "24" THEN FRACE = '4'; /* pacific islander */ ELSE FRACE = '0'; /* race unknown; /****** recode hispanic origin ******/ /* p10-2 21 && 24 */ IF MHISPC < '100' | ( '299' < MHISPC < '996') | MHISPC > '999' THEN MHISPC = "999"; * if code not in range, change to '999'; IF FHISPC < '100' | ( '299' < FHISPC < '996') | FHISPC > '999' THEN FHISPC = "999"; /* mother's hispanic origin */ IF '100' <= MHISPC <= '199' THEN rMHISP = '1'; /* non_Hispanic */ ELSE IF '200' <= MHISPC <= '209' THEN rMHISP = '7'; /* other Hispanic */ ELSE IF '210' <= MHISPC <= '220' THEN rMHISP = '2'; /* mexican */ ELSE IF '221' <= MHISPC <= '249' THEN rMHISP = '3'; /* south america */ ELSE IF '250' <= MHISPC <= '259' THEN rMHISP = '7'; /* other Hispanic */ ELSE IF '260' <= MHISPC <= '269' THEN rMHISP = '4'; /* puerto rican */ ELSE IF '270' <= MHISPC <= '274' THEN rMHISP = '5'; /* cuban */ ELSE IF '275' <= MHISPC <= '279' THEN rMHISP = '6'; /* dominican */ ELSE IF '280' <= MHISPC <= '299' THEN rMHISP = '7'; /* other Hispanic */ ELSE IF '996' <= MHISPC <= '999' THEN rMHISP = '9'; /* unknown */ IF rMHISP = '1' or rMHISP = '9' THEN DO; /* Non_Hispanic */ IF MRACE = '1' THEN MRACEHISP= '1'; /* NH White */ IF MRACE = '2' THEN MRACEHISP= '2'; /* NH Black */ IF MRACE = '3' THEN MRACEHISP= '3'; /* NH Other */ IF MRACE = '4' THEN MRACEHISP= '3'; /* NH Other */ END; ELSE IF '2'<=rMHISP<='7' THEN MRACEHISP= '4'; /* Hispanic */ RACEHISP = MRACEHISP; /* father's hispanic origin */ IF '100' <= FHISPC <= '199' THEN rFHISP = '1'; /* non_Hispanic */ ELSE IF '200' <= FHISPC <= '209' THEN rFHISP = '7'; /* other Hispanic */ ELSE IF '210' <= FHISPC <= '220' THEN rFHISP = '2'; /* mexican */ ELSE IF '221' <= FHISPC <= '249' THEN rFHISP = '3'; /* south america */ ELSE IF '250' <= FHISPC <= '259' THEN rFHISP = '7'; /* other Hispanic */ ELSE IF '260' <= FHISPC <= '269' THEN rFHISP = '4'; /* puerto rican */ ELSE IF '270' <= FHISPC <= '274' THEN rFHISP = '5'; /* cuban */ ELSE IF '275' <= FHISPC <= '279' THEN rFHISP = '6'; /* dominican */ ELSE IF '280' <= FHISPC <= '299' THEN rFHISP = '7'; /* other Hispanic */ ELSE IF '996' <= FHISPC <= '999' THEN rFHISP = '9'; /* unknown */ IF rFHISP = '1' THEN DO; /* Non_Hispanic */ IF FRACE = '1' THEN FRACEHISP= '1'; /* NH White */ IF FRACE = '2' THEN FRACEHISP= '2'; /* NH Black */ IF FRACE = '3' THEN FRACEHISP= '3'; /* NH Other */ IF FRACE = '4' THEN FRACEHISP= '3'; /* NH Other */ IF FRACE = '0' then FRACEHISP= '3'; END; ELSE IF '2'<=rFHISP<='7' THEN FRACEHISP= '4'; /* Hispanic */ ELSE IF rFHISP = '9' THEN FRACEHISP= '3'; /* Unknown */ END; ELSE DO; * mrace is valid, use mrace and hispm; IF (RACEM < '0' | RACEM > '9') & RACEM NOT IN('A', 'B', 'C', 'D', 'E') THEN RACEM = '9'; * other entries; * if mother's race not reported, either using father's race if it is good or using previous observations race of mother if father's race is bad.; IF RACEM = '9' | RACEM = '0' THEN DO; /* impute from father's or pre_race */ IF '0' < RACEF <= '8' | RACEF IN ('A','B','C','D','E') THEN RACEM = RACEF; ELSE RACEM = PRE_RACE; END; ELSE IF '0' < RACEM <= '8' | RACEM IN ('A','B','C','D','E') THEN PRE_RACE = RACEM; /* recode race */ /* mother's race */ IF RACEM = "1" THEN MRACE = '1'; /* white */ ELSE IF RACEM = "2" THEN MRACE = '2'; /* black */ ELSE IF RACEM = "3" THEN MRACE = '3'; /* american_indian */ ELSE IF "4" <= RACEM <= "8" | RACEM IN ('A','B','C','D','E') THEN MRACE = '4'; /* pacific_islander */ /* father's race */ IF RACEF = "1" THEN FRACE = '1'; /* white */ ELSE IF RACEF = "2" THEN FRACE = '2'; /* black */ ELSE IF RACEF = "3" THEN FRACE = '3'; /* american indian */ ELSE IF "4" <= RACEF <= "8" | RACEF IN ('A','B','C','D','E') THEN FRACE = '4'; /* pacific_islander */ /* 25 a && 25 b */ /* recode hispanic origin */ /* mother's hispanic origin */ IF HISPM NOT IN ('0', '1', '2', '3', '4', '5', '9') THEN HISPM = '9'; IF HISPM = '0' THEN rMHISP = '0'; /* non_Hispanic */ ELSE IF HISPM = '1' THEN rMHISP = '1'; /* mexican */ ELSE IF HISPM = '2' THEN rMHISP = '2'; /* puerto rican */ ELSE IF HISPM = '3' THEN rMHISP = '3'; /* cuban */ ELSE IF HISPM = '4' THEN rMHISP = '4'; /* central or south america */ ELSE IF HISPM = '5' THEN rMHISP = '5'; /* other and unknown Hispanic */ ELSE IF HISPM = '9' THEN rMHISP = '9'; /* unknown */ IF rMHISP = '0' or rMHISP = '9' THEN DO; /* Non_Hispanic */ IF MRACE = '1' THEN MRACEHISP= '1'; /* NH White */ IF MRACE = '2' THEN MRACEHISP= '2'; /* NH Black */ IF MRACE = '3' THEN MRACEHISP= '3'; /* NH Other */ IF MRACE = '4' THEN MRACEHISP= '3'; /* NH Other */ END; ELSE IF '1'<= rMHISP <='5' THEN MRACEHISP= '4'; /* Hispanic */ RACEHISP = MRACEHISP; /* father's hispanic origin */ IF HISPF NOT IN ('0', '1', '2', '3', '4', '5', '9') THEN HISPF = '9'; IF HISPF = '0' THEN rFHISP = '0'; /* non_Hispanic */ ELSE IF HISPF = '1' THEN rFHISP = '1'; /* mexican */ ELSE IF HISPF = '2' THEN rFHISP = '2'; /* puerto rican */ ELSE IF HISPF = '3' THEN rFHISP = '3'; /* cuban */ ELSE IF HISPF = '4' THEN rFHISP = '4'; /* central or south america */ ELSE IF HISPF = '5' THEN rFHISP = '5'; /* other Hispanic */ ELSE IF HISPF = '9' THEN rFHISP = '9'; /* unknown */ IF rFHISP = '0' OR rFHISP = '9' THEN DO; /* Non_Hispanic */ IF FRACE = '1' THEN FRACEHISP= '1'; /* NH White */ IF FRACE = '2' THEN FRACEHISP= '2'; /* NH Black */ IF FRACE = '3' THEN FRACEHISP= '3'; /* NH Other */ IF FRACE = '4' THEN FRACEHISP= '3'; /* NH Other */ IF FRACE = '0' then FRACEHISP= '3'; END; ELSE IF '1'<= rFHISP <='5' THEN FRACEHISP= '4'; /* Hispanic */ ELSE IF rFHISP = '9' THEN FRACEHISP= '9'; /* Unknown */ END; /*create a new variable(wt) and assign a value to it based on the birth weight and use this value, gestation month and Hispanic origin in ARRAY below to locate the single gestation week */ IF oBWT < "0500" THEN wt = 0; ELSE IF oBWT < "1000" THEN wt = 1; ELSE IF oBWT < "1500" THEN wt = 2; ELSE IF oBWT < "2000" THEN wt = 3; ELSE IF oBWT < "2500" THEN wt = 4; ELSE IF oBWT < "3000" THEN wt = 5; ELSE IF oBWT < "3500" THEN wt = 6; ELSE IF oBWT < "4000" THEN wt = 7; ELSE IF oBWT < "4500" THEN wt = 8; ELSE IF oBWT < "5000" THEN wt = 9; ELSE wt = 10; /*P25 6. */ /* For records missing only day of LMP and with valid birth weight,compute period of gestation as follow:*/ /*p25 6.1 */ * convert month and year of birth and month and year of LMP into century months. (Century month = year of event times 12 plus month of event); IF LMP_DD = "99" & LMP_MM ^= "99" & LMP_YY ^= "9999" & oBWT ^= "9999" THEN DO; DOB_CENT = INPUT(DOB_YY, 4.) * 12 + INPUT(DOB_MM, 2.); LMP_CENT = INPUT(LMP_YY, 4.) * 12 + INPUT(LMP_MM, 2.); /* p26 6.2 Compute Month Difference: Month Difference = Century month of birth date minus century month of LMP. If computed month difference is negtive, add 12. If computed month difference is 12 or higher, or less than 4, assign code 99 for weeks of gestation.; */ GESTMTH = DOB_CENT - LMP_CENT; IF GESTMTH < 0 THEN GESTMTH = GESTMTH + 12; IF GESTMTH < 4 | GESTMTH >= 12 THEN COMP_GEST = 99; /* p26 6.3 Impute single weeks of gestation (17-47) for each racial group of mother (Non-Hispanic white, non-Hispanic Black, Non-Hispanic other, and Hispanic) using the following matrix. The initial matrix is created for each racial group based on previous year cases with complete reporting of date LMP. The matrix will change as processing proceeds to reflect the last record with complete reporting of date of LMP, birth weight, and Hispanic orogin. */ /* RaceHisp(4) */ /* NHWHITE(0:10, 5:10) (wt(11), gestmth(6)) */ /* <6 6 7 8 9 10+ */ /* 20,21,24,28,33,39, /* <500 */ /* 18,23,29,31,34,38, /* 500 - 999 */ /* 18,22,26,32,38,39, /* 1000 - 1499 */ /* 18,21,27,31,38,40, /* 1500 - 1999 */ /* 18,23,25,30,34,40, /* 2000 - 2499 */ /* 18,23,28,33,35,39, /* 2500 - 2999 */ /* 18,23,27,32,38,39, /* 3000 - 3499 */ /* 17,17,24,34,38,39, /* 3500 - 3999 */ /* 19,23,27,30,34,39, /* 4000 - 4499 */ /* 17,21,26,31,36,39, /* 4500 - 4999 */ /* 18,23,27,31,38,40, /* >= 5000 */ /* NHBLACK(0:10, 5:10) (wt(11), gestmth(6)) */ /* <6 6 7 8 9 10+ */ /* 18,23,26,29,33,39, /* <500 */ /* 19,22,26,33,35,39, /* 500 - 999 */ /* 17,22,26,31,38,39, /* 1000 - 1499 */ /* 18,21,25,32,38,40, /* 1500 - 1999 */ /* 19,21,28,30,34,38, /* 2000 - 2499 */ /* 19,22,26,31,37,39, /* 2500 - 2999 */ /* 17,22,27,34,38,39, /* 3000 - 3499 */ /* 20,21,24,29,34,40, /* 3500 - 3999 */ /* 18,23,27,31,34,39, /* 4000 - 4499 */ /* 17,22,26,31,37,39, /* 4500 - 4999 */ /* 19,21,27,33,36,40, /* >= 5000 */ /* NHOTHER(0:10, 5:10) (wt(11), gestmth(6)) */ /* <6 6 7 8 9 10+ */ /* 20,23,28,30,34,39, /* <500 */ /* 17,21,27,32,37,39, /* 500 - 999 */ /* 17,23,26,31,38,40, /* 1000 - 1499 */ /* 19,21,23,31,36,39, /* 1500 - 1999 */ /* 17,20,29,32,35,39, /* 2000 - 2499 */ /* 19,21,27,31,38,39, /* 2500 - 2999 */ /* 17,21,27,32,38,40, /* 3000 - 3499 */ /* 18,23,26,29,33,39, /* 3500 - 3999 */ /* 18,23,26,32,35,39, /* 4000 - 4499 */ /* 18,23,26,31,38,39, /* 4500 - 4999 */ /* 17,23,25,29,37,40, /* >= 5000 */ /* HISP(0:10, 5:10) (wt(11), gestmth(6)) */ /* <6 6 7 8 9 10+ */ /* 20,21,24,28,33,39, /* <500 */ /* 18,23,29,31,34,38, /* 500 - 999 */ /* 18,22,26,32,38,39, /* 1000 - 1499 */ /* 18,21,27,31,38,40, /* 1500 - 1999 */ /* 18,23,25,30,34,40, /* 2000 - 2499 */ /* 18,23,28,33,35,39, /* 2500 - 2999 */ /* 18,23,27,32,38,39, /* 3000 - 3499 */ /* 17,17,24,34,38,39, /* 3500 - 3999 */ /* 19,23,27,30,34,39, /* 4000 - 4499 */ /* 17,21,26,31,36,39, /* 4500 - 4999 */ /* 18,23,27,31,38,40 /* >= 5000 */ IF GESTMTH < 6 THEN GESTMTH = 5; * regroup the gestation month for; IF GESTMTH >=10 THEN GESTMTH = 10; * the array assignment below; IF COMP_GEST ^= 99 & oBWT ^= "9999" THEN DO; /*******************************************************/ /* Extract comp_gest from hotdeck for racords only */ /* missing day of LMP with valid birth weight */ /*******************************************************/ ***** Non-Hispanic White ***** ; IF RACEHISP= '1' THEN COMP_GEST = NHWHITE(WT,GESTMTH); ***** Non_Hispanic Black *****; IF RACEHISP= '2' THEN COMP_GEST = NHBLACK(WT, GESTMTH); ***** Non_Hispanic Other *****; IF RACEHISP= '3' THEN COMP_GEST = NHOTHER(WT, GESTMTH); ***** Hispanic *****; IF RACEHISP= '4' THEN COMP_GEST = HISP(WT, GESTMTH); END; END; /* Insert comp_gest to hotdeck when data for following 4 variables are good */ IF LMP_DD ^= "99" & LMP_MM ^= "99" & LMP_YY ^= "9999" & oBWT ^= "9999" THEN DO; IF 17 <= COMP_GEST <= 47 THEN DO; DOB_CENT = INPUT(DOB_YY, 4.) * 12 + INPUT(DOB_MM, 2.); LMP_CENT = INPUT(LMP_YY, 4.) * 12 + INPUT(LMP_MM, 2.); GESTMTH = DOB_CENT - LMP_CENT; IF GESTMTH < 0 THEN GESTMTH = GESTMTH + 12; IF GESTMTH < 4 | GESTMTH >= 12 THEN COMP_GEST = 99; IF GESTMTH < 6 THEN GESTMTH = 5; * regroup the gestation month for; IF GESTMTH >=10 THEN GESTMTH = 10; * the array assignment below; IF COMP_GEST ^= 99 THEN DO; IF RACEHISP= '1' THEN NHWHITE(WT,GESTMTH) = COMP_GEST; IF RACEHISP= '2' THEN NHBLACK(WT,GESTMTH) = COMP_GEST; IF RACEHISP= '3' THEN NHOTHER(WT,GESTMTH) = COMP_GEST; IF RACEHISP= '4' THEN HISP(WT,GESTMTH) = COMP_GEST; END; END; END; /* p27 6.4 check to insure that imputed weeks of gestation is not impossible, given the DAY of birth. */ /* P27 6.4.1. Compute the longest theoretical number of weeks of gestation from actual day of birth with the assumption that the day of LMP is the first day of the month of LMP. Similarly, compute the shortest theoretical number of weeks of gestation by assuming that the day of LMP is the last day of the month of LMP. To compute these two theoretical periods of gestation, follow the same procedure as outlined for records with complete LMP date (see B.5.). If the imputed weeks of gestation is fewer than the lowest theoretical number, substitute the lowest theorctical number. Similarly, if the imputed weeks of gestation is greater than the highest theoretical number, substitute the highest theoretical number. Check to see that the substitution falls within the range of 17 to 47 weeks. If outside this range, change imputed value to 99. */ IF LMP_DD = '99' & LMP_MM ^= '99' & LMP_YY ^= "9999" & COMP_GEST ^= 99 THEN DO; /* maximum days, assuming first day of LMP. */ MAXDAYS = (S_D_F(INPUT(DOB_MM, 2.)) + INPUT(DOB_DD, 2.)) - (S_D_F_L(INPUT(LMP_MM, 2.)) + 1); IF MAXDAYS <= 0 THEN MAXDAYS = MAXDAYS + 365; /* longest theoretical number of weeks of gestation */ MAXWKS = INT(MAXDAYS / 7); /* minmum days, assuming last day of LMP. */ IF LMP_MM < '12' THEN MINDAYS = (S_D_F(INPUT(DOB_MM, 2.)) + INPUT(DOB_DD, 2.)) - (S_D_F_L(INPUT(LMP_MM, 2.) + 1)); * for Jan.-Nov.; ELSE IF LMP_MM = '12' THEN MINDAYS = (S_D_F(INPUT(DOB_MM, 2.)) + INPUT(DOB_DD, 2.)) - (S_D_F_L(INPUT(LMP_MM, 2.)) + 31); * for Dec.; IF MINDAYS <= 0 THEN MINDAYS = MINDAYS + 365; /* shortest theoretical number of weeks of gestation */ MINWKS = INT(MINDAYS / 7); IF COMP_GEST < MINWKS THEN DO; COMP_GEST = MINWKS; END; IF COMP_GEST > MAXWKS THEN DO; COMP_GEST = MAXWKS; END; IF COMP_GEST < 17 | COMP_GEST > 47 THEN DO; COMP_GEST = 99; END; END; /* P33 Obstetric Estimation of Gestation(clinest) (Output pos. 76-77). B1. If not coded 17-47 or 99, change code to 99 */ OBGEST = CLINEST; * create a new variable used in PGM; IF OBGEST < '17' | ObGEST > '47' & ObGEST ^='99' THEN OBGEST = '99'; OBGESTok = 0; /* p33 B.2. Generate a combined gestation field called comb_gest. */ /* p33 B.2.1 comp_gest prefered. Except as noted in B2.2, IF LMP gestation is 17 to 47 weeks, enter LMP gestation in combined gestation field. */ /* use computed gestation if possible */ IF 17 <= COMP_GEST <= 47 THEN COMB_GEST = COMP_GEST; /* p33 B.2.2 If LMP gestation is 17 to 47 weeks, check compatibility with birth weight as follow:*/ /* B.2.2.1 Once plurality is edited, compare weeks of gestation derived from LMP date with birth weight using the following table: */ /* If weeks of gestation AND Then birth weight based on LMP date are: Plurality is: should be: _________________________________________________________________________ A) Less than 20 weeks All Less than 1,000 grams B) 20-23 weeks All Less then 2,000 grams C) 24-27 weeks All Less than 3,000 grams D) 28-31 weeks All Less than 4,000 grams E) 32-35 weeks Singleton 500 grams or more* F) 36 or more weeks Singleton 750 grams or more* _________________________________________________________________________ * See 2.2.3 */ /* Edit comp_gest for valid values overwrite comb_gest if consistency check failed */ COMPGESTok = 0; IF 17 <= COMP_GEST <= 47 & OBWT ^= '9999' THEN DO; IF COMP_GEST < 20 & PLUR > '0' THEN DO; IF oBWT < '1000' THEN COMPGESTok = 1; END; ELSE IF 20 <= COMP_GEST <= 23 & PLUR > '0' THEN DO; IF oBWT < '2000' THEN COMPGESTok = 2; END; ELSE IF 24 <= COMP_GEST <= 27 & PLUR > '0' THEN DO; IF oBWT < '3000' THEN COMPGESTok = 3; END; ELSE IF 28 <= COMP_GEST <= 31 & PLUR > '0' THEN DO; IF oBWT < '4000' THEN COMPGESTok = 4; END; IF PLUR > '1' & COMPGESTok = 0 THEN COMPGESTok = 5; ELSE IF 32 <= COMP_GEST <= 35 & PLUR = '1' THEN DO; IF oBWT >= '0500' THEN COMPGESTok = 6; END; ELSE IF COMP_GEST > 35 & PLUR = '1' THEN DO; IF oBWT >= '0750' THEN COMPGESTok = 7; END; /* p33 B.2.2.2 If records fail consistency checks A through F, then compare obstetric estimate of gestation with birth weight using these same parameters. */ /* computed gestation bad so try to use obgest */ IF COMPGESTok = 0 THEN DO; IF '17' <= ObGEST <= '47' THEN DO; OBGESTok = 0; IF ObGEST < '20' & PLUR > '0' THEN DO; IF oBWT < '1000' THEN OBGESTok = 1; END; ELSE IF '20' <= ObGEST <= '23' & PLUR > '0' THEN DO; IF oBWT < '2000' THEN OBGESTok = 2; END; ELSE IF '24' <= OBGEST <= '27' & PLUR > '0' THEN DO; IF oBWT < '3000' THEN OBGESTok = 3; END; ELSE IF '28' <= OBGEST <= '31' & PLUR > '0' THEN DO; IF oBWT < '4000' THEN OBGESTok = 4; END; IF PLUR > '1' & OBGESTok = 0 THEN OBGESTok = 5; ELSE IF '32' <= OBGEST <= '35' & PLUR = '1' THEN DO; IF oBWT >= '0500' THEN OBGESTok = 6; END; ELSE IF OBGEST > '35' & PLUR = '1' THEN DO; IF oBWT >= '0750' THEN OBGESTok = 7; END; END; /* p34 B.2.2.2.4 */ /* obgest is also bad so assign 99 to comb_gest */ ELSE IF obgest = '99' THEN COMB_GEST = 99; /* p34 B.2.2.2.1 If the obstetric estimate IS 17-47 WEEKS and IS compatible with birth weight, enter the obstetric estimate in combined gestation field. */ IF OBGESTok >= 1 THEN COMB_GEST = INPUT(OBGEST, 2.); /* obgest ok */ /* p34 B.2.2.2.2 If obstetric estimate is also not compatible with birth weight, but is within plus or minus 5 weeks of gestation based on LMP date, code birth weight '9999', and enter gestation period based on LMP date in combined gestation field. */ ELSE IF OBGESTok = 0 & ((COMP_GEST - 5) <= INPUT(OBGEST, 2.) <= (COMP_GEST + 5)) & 17 <= INPUT(OBGEST, 2.) <= 47 THEN DO; BWT = '9999'; COMB_GEST = COMP_GEST; END; /* p34 B.2.2.2.3 If obstetric estimate is also not compatible with birth weight, and is not within plus or minus 5 weeks of period of gestation based on LMP date, code birth weight '9999', and code combined gestation field 99. */ ELSE IF OBGESTok = 0 & INPUT(OBGEST, 2.) < (COMP_GEST - 5) | INPUT(OBGEST, 2.) > (COMP_GEST + 5) & 17 <= INPUT(OBGEST, 2.) <= 47 THEN DO; BWT = '9999'; COMB_GEST = 99; END; /* p34 B.2.2.2.4 If clinical estimate is unknown, code combined gestation field 99 */ ELSE IF OBGEST = '99' THEN COMB_GEST = 99; END; /* p35 B.2.2.3 If LMP gestation is 32-35, plurality is single and birth weight is 500-999 grams, OR if LMP gestation is 36-weeks or more, plurality is single, and birth weight is 750-999 grams, check for consistency between LMP gestation and the clinical estimate. If the clinical estimate is three weeks or more LESS THAN the LMP gestation, enter the clinical estimate in the combined gestation field. Otherwise, leave all variables as reported. */ IF( 32 <= COMP_GEST <= 35 & PLUR = '1' & '0500' <= oBWT <= '0999') | (COMP_GEST >= 36 & PLUR = '1' & '0750' <= oBWT <= '0999') THEN DO; IF INPUT(OBGEST, 2.) <= (COMP_GEST - 3) THEN DO; COMB_GEST = INPUT(OBGEST, 2.); END; END; END; /* p35 B.2.3 If LMP gestation is coded 99, and birth weight < '0227' or > '8165', and obgest is in 17-47, use clinical estimate of gestation in combined field. */ IF COMP_GEST = 99 THEN DO; /* p35 50.2.3.1 Compare weeks of gestation based on clinical estimate with birth weight, using chart in p33 B2.2. */ IF '17' <= OBGEST <= '47' THEN DO; OBGESTok = 0; IF OBGEST < '20' THEN DO; IF oBWT < '1000' | BWT < '0227' | BWT > '8165' THEN OBGESTok = 1; END; ELSE IF '20' <= OBGEST <= '23' THEN DO; IF oBWT < '2000' | BWT < '0227' | BWT > '8165' THEN OBGESTok = 2; END; ELSE IF '24' <= OBGEST <= '27' THEN DO; IF oBWT < '3000' | BWT < '0227' | BWT > '8165' THEN OBGESTok = 3; END; ELSE IF '28' <= OBGEST <= '31' THEN DO; IF oBWT < '4000' | BWT < '0227' | BWT > '8165' THEN OBGESTok = 4; END; IF PLUR > '1' & OBGESTok = 0 THEN OBGESTok = 5; ELSE IF '32' <= OBGEST <= '35' & PLUR = '1' THEN DO; IF oBWT >= '0500' | BWT < '0227' THEN OBGESTok = 6; END; ELSE IF OBGEST > '35' & PLUR = '1' THEN DO; IF oBWT >= '0750' | BWT < '0227' THEN OBGESTok = 7; END; END; /* p35 B.2.3.1.1 If records fail consistency checks A, B, C,or D, OR if cliical estimate is 32-35 weeks, plurality is single, and birth weight is less than 500 grams, OR if clinical estimate is 36 weeks or more, plurality is single, and birth weight is less than 750 grams, code combined gestation field 99. */ IF OBGESTok = 0 | ('32' <= OBGEST <= '35' & PLUR = '1' & '0227' <= BWT < '0500') | (OBGEST >= '36' & PLUR = '1' & '0227' <= BWT < '0750') THEN DO; COMB_GEST = 99; END; /* p36 B.2.3.1.2 Otherwise, enter clinical estimate in combined gestation field. */ ELSE COMB_GEST = INPUT(OBGEST, 2.); END; OUTPUT NAT.GEST&STE; IF EOF THEN OUTPUT NAT.MATRIX; * keep the hotdeck for reference only; RUN; /* print first 50 observatiobs */ OPTIONS PAGENO = 1 LS=90 PS= 70; PROC PRINT DATA=NAT.GEST&STE(obs=1000); TITLE "Computed Gestation and Combined Gestation for the STATE of &ST, year &YR"; VAR STATE CERT COMP_GEST COMB_GEST; * VAR STATE CERT LMP_YY LMP_MM LMP_DD LMPLeap DOB_YY DOB_MM DOB_DD DOBLeap POBLeap CALCDAY INTDAY COMP_GEST COMB_GEST; RUN; DATA _NULL_; CALL SOUND(400,200); RUN;