*************************************************************************; * PROGRAM NAME: ReadinData.sas *; * DATE CREATED: 09/23/03 *; * LAST UPDATED: 10/27/03 *; * *; * PROGRAMMERS: NYC DOHMH Bureau of Communicable Disease *; * PURPOSE: Sample program reads in data from 4 file types and *; * transforms into standard format *; ************************************************************************; * We've found these options to be useful; options ls=120 /*Wide page less likely to wrap output*/ ps=5000 /*Long page-size less likely to split up a table*/ nodate /*Suppresses date at top of page in output*/ nocenter /*Left-justifies output*/ nonumber /*Suppresses page number in output*/ yearcutoff=1920 formdlim='-' /*Saves paper, no page return between procedure output*/ ; * Create a SAS library name for data folder; libname data "c:\SyndromicWorkshop\sas\data"; * Create macro for data folder. If you want to put data in a different location you only have to change this line and all macro references throughout the program will be changeed; %LET FOLDER=c:\SyndromicWorkshop\sas\data; *ED1: Report format; data readED1; attrib cc length=$50.; infile "&FOLDER\ED1_072503.txt" lrecl=100 pad; *YOU NEED THE DOUBLE QUOTES IF USING MACRO!!!!; input @2 id $11. @14 age $3. @19 sex $1. @23 zip $5. @29 cc2 $30. @60 mode $3. @66 datetxt $8. @75 time $5.; EDcode='ED1'; if id ^=: 'XX' then delete; cc=cc2; drop cc2; run; *ED2: Two EDs in same file, AM/PM; data readED2; infile "&FOLDER\ED2_072503.txt" lrecl=100 pad; attrib time length=$5. id length=$15.; input @1 EDcode1 $1. @2 datetxt $8. @10 hour 2. @13 minute $2. @15 AMPM $1. @17 age $3. @21 sex $1. @22 cc $50. @72 zip $5.; yr=substr(datetxt,7,2)*1; drop yr; if 0