*options obs=100 ; options nocenter ; /*------------------------------------------------ by Jean Roth Mon Jul 2 15:44:18 EDT 2007 This program reads the 2002 National Health Interview Survey 2002 altverbt 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/2002/altverbt.exe "; * The following line should contain the name of the SAS dataset ; %let dataset = nhis2002_altverbt ; 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 acucspec length=$80 label="Other, specify"; attrib ayucspec length=$80 label="Other, specify"; attrib biocspec length=$80 label="Other, specify"; attrib checspec length=$80 label="Other, specify"; attrib chpcspec length=$80 label="Other, specify"; attrib ehtcspec length=$80 label="Other, specify"; attrib fmdcspec length=$80 label="Other, specify"; attrib mascspec length=$80 label="Other, specify"; attrib natcspec length=$80 label="Other, specify"; attrib hrbcspec length=$80 label="Other, specify"; attrib homcspec length=$80 label="Other, specify"; attrib ditcspec length=$80 label="Other, specify"; attrib vitcspec length=3 label="Other, specify"; attrib ytqcspec length=3 label="Other, specify"; attrib relcspec length=3 label="Other, specify"; attrib pracspec length=3 label="Other, specify"; INPUT @1 rectype 2. @3 srvy_yr 4. @7 hhx $6. @13 fmx $2. @15 px $2. @17 acucspec $80. @97 ayucspec $80. @177 biocspec $80. @257 checspec $80. @337 chpcspec $80. @417 ehtcspec $80. @497 fmdcspec $80. @577 mascspec $80. @657 natcspec $80. @737 hrbcspec $80. @817 homcspec $80. @897 ditcspec $80. @977 -105 vitcspec -976. @1057 -11 ytqcspec -1056. @1137 -12 relcspec -1136. @1217 -12 pracspec -1216. ; /*------------------------------------------------ The PROC FORMAT statement will store the formats in a sas data set called faltv02 To use the stored formats in a subsequent program, use code like the following: proc format cntlin=library.faltv02; PROC freq; tables pesex ; format pesex P135L.; For more information, consult PROC FORMAT in the SAS Procedures Guide ----------------------------------------------- */ PROC FORMAT cntlout=library.faltv02; ; VALUE rectype (default=32) 33 = "Verbatim Alternative Health Supplement" ; VALUE srvy_yr (default=32) 2002 = "2002" ; proc print data=library.nhis2002_altverbt (obs=6); FORMAT rectype rectype. srvy_yr srvy_yr. ; proc contents data=library.nhis2002_altverbt; /* 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. */