*options obs=100 ; options nocenter ; /*------------------------------------------------ by Jean Roth Mon Jul 2 15:41:59 EDT 2007 This program reads the 2001 National Health Interview Survey 2001 injverbt Data File Report errors to jroth@nber.org This program is distributed under the GNU GPL. See end of this file and http://www.gnu.org/licenses/ for details. ----------------------------------------------- */ * The following line should contain the directory where the SAS file is to be stored ; libname library "./"; * The following line should contain the complete path and name of the raw data file. On a PC, use backslashes in paths as in C:\ ; FILENAME datafile pipe "unzip -p /homes/data/nhis/ftp.cdc.gov/pub/Health_Statistics/NCHS/Datasets/NHIS/2001/injverbt.exe "; * The following line should contain the name of the SAS dataset ; %let dataset = nhis2001_injverbt ; DATA library.&dataset ; INFILE datafile LRECL = 20000 ; attrib rectype length=3 label="Record Type"; attrib srvy_yr length=4 label="Survey Year"; attrib hhx length=$6 label="Household Serial Number"; attrib fmx length=$2 label="Family Serial Number"; attrib px length=$2 label=""; attrib ipepno length=$2 label="Number of injury/poisoning"; attrib ijbody1 length=$35 label="Body part injured/poisoned"; attrib ijbody2 length=$35 label="Body part injured/poisoned"; attrib ijbody3 length=$35 label="Body part injured/poisoned"; attrib ijbody4 length=$35 label="Body part injured/poisoned"; attrib ijkind1 length=$45 label="Kind of injury/poisoning"; attrib ijkind2 length=$45 label="Kind of injury/poisoning"; attrib ijkind3 length=$45 label="Kind of injury/poisoning"; attrib ijkind4 length=$45 label="Kind of injury/poisoning"; attrib ijhow1 length=$85 label="Description of injury/poisoning"; attrib ijhow2 length=$85 label="Description of injury/poisoning"; attrib ijhow3 length=$85 label="Description of injury/poisoning"; attrib ijhow4 length=$85 label="Description of injury/poisoning"; INPUT @1 rectype 2. @3 srvy_yr 4. @7 hhx $6. @13 fmx $2. @15 px $2. @17 ipepno $2. @19 ijbody1 $35. @54 ijbody2 $35. @89 ijbody3 $35. @124 ijbody4 $35. @159 ijkind1 $45. @204 ijkind2 $45. @249 ijkind3 $45. @294 ijkind4 $45. @339 ijhow1 $85. @424 ijhow2 $85. @509 ijhow3 $85. @594 ijhow4 $85. ; /*------------------------------------------------ The PROC FORMAT statement will store the formats in a sas data set called finjv01 To use the stored formats in a subsequent program, use code like the following: proc format cntlin=library.finjv01; PROC freq; tables pesex ; format pesex P135L.; For more information, consult PROC FORMAT in the SAS Procedures Guide ----------------------------------------------- */ PROC FORMAT cntlout=library.finjv01; ; VALUE rectype (default=32) 75 = "Verbatim Injury/Poisoning Episode" ; VALUE srvy_yr (default=32) 2001 = "2001" ; VALUE $ipepno (default=32) ""01"" = "First injury or poisoning" ""02"" = "Second injury or poisoning" ""03"" = "Third injury or poisoning" ""04"" = "Fourth injury or poisoning" ""05"" = "Fifth injury or poisoning" ""06"" = "Sixth injury or poisoning" ""07"" = "Seventh injury or poisoning" ""08"" = "Eighth injury or poisoning" ""09"" = "Ninth injury or poisoning" ""10"" = "Tenth injury or poisoning" ; proc print data=library.nhis2001_injverbt (obs=6); FORMAT rectype rectype. srvy_yr srvy_yr. ipepno $ipepno. ; proc contents data=library.nhis2001_injverbt; /* Copyright 2007 shared by the National Bureau of Economic Research and Jean Roth National Bureau of Economic Research. 1050 Massachusetts Avenue Cambridge, MA 02138 jroth@nber.org This program and all programs referenced in it are free software. You can redistribute the program or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */