set more off /********************************************************************** THIS IS AN EXAMPLE OF A PROGRAM THAT CAN BE USED TO READ IN THE LINKED NHIS-HUD AND NHANES-HUD FEASIBILITY STUDY ASCII FILES. TO DOWNLOAD AND SAVE THE LINKED NCHS-HUD FEASIBILITY STUDY ASCII FILE TO YOUR HARD DRIVE, FOLLOW THESE STEPS: *STEP 1: DESIGNATE A FOLDER ON YOUR HARD DRIVE TO DOWNLOAD THE LINKED NHIS-HUD AND NHANES-HUD FEASIBILITY STUDY ASCII FILES. IN THIS EXAMPLE, THE DATA WILL BE SAVED IN: 'C:\Feasibility Study Data\' *STEP 2: DOWNLOAD THE ASCII DATA FROM THE NCHS WEB SITE. GO TO THE NCHS WEB SITE (LINK BELOW) AND DOWNLOAD THE LINKED NHIS-HUD AND NHANES-HUD FEASIBILITY STUDY ASCII FILES TO THE FOLDER 'C:\Feasibility Study Data\' ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/datalinkage/hud/HUD_FEASIBILITY_NHIS.ascii ftp://ftp.cdc.gov/pub/Health_Statistics/NCHS/datalinkage/hud/HUD_FEASIBILITY_NHANES.ascii NOTES: THIS PROGRAM ASSUMES THAT THE ASCII DATA FILE IS IN STATA'S WORKING DIRECTORY. AN EXAMPLE OF HOW TO CHANGE THE WORKING DIRECTORY WITHIN STATA IS THE FOLLOWING COMMAND: cd "C:\Feasibility Study Data\" *IMPORTANT INFORMATION REGARDING THE SURVEY ID VARIABLE: FOR NHIS USE PUBLICID AS THE ID VARIABLE FOR NHANES USE SEQN AS THE ID VARIABLE *********************************************************************/ # delimit ; /* CHANGE WORKING DIRECTORY TO FIND FILE */ cd "C:\Feasibility Study Data\"; /*TO READ IN THE LINKED NHIS-HUD FEASIBILITY STUDY ASCII FILE */ /* INPUT ALL NEW VARIABLES */ infix str publicid 1-14 str survey_name 16-31 hud_match_status 40 ever_hcv 42 ever_hud 44 ever_mf 46 ever_ph 48 using hud_feasibility_nhis.ascii, clear ; /* DEFINE VARIABLE LABELS */ label variable publicid "NHIS PUBLIC ID"; label variable survey_name "SURVEY NAME"; label variable hud_match_status "NCHS-HUD MATCH STATUS"; label variable ever_hcv "EVER LINKED TO HCV"; label variable ever_hud "EVER LINKED TO HUD"; label variable ever_mf "EVER LINKED TO MF"; label variable ever_ph "EVER LINKED TO PH"; /* DISPLAY OVERALL DESCRIPTION OF FILE */ describe; codebook,all; /* DATA FILE IS STORED IN FEASIBILITY.DTA */ save feasibility_nhis.dta, replace; ***********************************************************************************; /*TO READ IN THE LINKED NHANES-HUD FEASIBILITY STUDY ASCII FILE */ #delimit ; /* INPUT ALL NEW VARIABLES */ infix seqn 1-15 str survey_name 16-31 hud_match_status 40 ever_hcv 42 ever_hud 44 ever_mf 46 ever_ph 48 using hud_feasibility_nhanes.ascii, clear ; /* DEFINE VARIABLE LABELS */ label variable seqn "NHANES SEQUENCE NUMBER"; label variable survey_name "SURVEY NAME"; label variable hud_match_status "NCHS-HUD MATCH STATUS"; label variable ever_hcv "EVER LINKED TO HCV"; label variable ever_hud "EVER LINKED TO HUD"; label variable ever_mf "EVER LINKED TO MF"; label variable ever_ph "EVER LINKED TO PH"; /* FORMAT ZERO FILL ID VARIABLE (SEQN) */ format seqn %05.0f; /* DISPLAY OVERALL DESCRIPTION OF FILE */ describe; codebook,all; /* DATA FILE IS STORED IN FEASIBILITY.DTA */ save feasibility_nhanes.dta, replace; #delimit cr