1 The SAS System 15:11 Tuesday, June 26, 2007 NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA. NOTE: SAS (r) 9.1 (TS1M3) Licensed to HARVARD SCHOOL OF PUBLIC HEALTH-INSTRUCTIONAL COMP, Site 0001177014. NOTE: This session is executing on the SunOS 5.9 platform. NOTE: SAS 9.1.3 Service Pack 3 ----------------------------------------------------------------------- NBER NOTE: sas now defaults to sas9. sas8 or sas6 will invoke sas version 8 or 6 respectively. - 2005/10/21 ----------------------------------------------------------------------- You are running SAS 9. Some SAS 8 files will be automatically converted by the V9 engine; others are incompatible. Please see http://support.sas.com/rnd/migration/planning/platform/64bit.html PROC MIGRATE will preserve current SAS file attributes and is recommended for converting all your SAS libraries from any SAS 8 release to SAS 9. For details and examples, please see http://support.sas.com/rnd/migration/index.html This message is contained in the SAS news file, and is presented upon initialization. Edit the file "news" in the "misc/base" directory to display site-specific news and information in the program log. The command line option "-nonews" will prevent this display. NOTE: SAS initialization used: real time 0.97 seconds cpu time 0.27 seconds 1 options obs=100 ; 2 options nocenter ; 3 ** 4,118,907 births in 2004; 4 5 /*------------------------------------------------ 6 by Jean Roth Mon Apr 10 14:44:24 EDT 2006 7 This program reads the 2004 NCHS Natality Data File 8 Report errors to jroth@nber.org 9 This program is distributed under the GNU GPL. 10 See end of this file and 11 http://www.gnu.org/licenses/ for details. 12 ----------------------------------------------- */ 13 14 * The following line should contain the directory 15 where the SAS file is to be stored ; 16 17 libname library "./"; NOTE: Libref LIBRARY was successfully assigned as follows: Engine: V9 Physical Name: /disk/nber10/SCCS/natality/2004/data 18 19 * The following line should contain 20 the complete path and name of the raw data file. 2 The SAS System 15:11 Tuesday, June 26, 2007 21 On a PC, use backslashes in paths as in C:\ ; 22 23 *FILENAME datafile pipe "zcat /homes/data/natality/2004/data/natl2004.dat.Z "; 24 FILENAME datafile pipe "unzip -p /homes/nber/jroth/bulk/natl2004.zip "; 25 *FILENAME datafile pipe "unzip -p /homes/data/natality/2004/data/natl2004.zip "; 26 *FILENAME datafile "/homes/data/natality/2004/data/natl04.dat "; 27 28 * The following line should contain the name of the SAS dataset ; 29 30 %let dataset = natl2004 ; 31 32 DATA library.&dataset ; 33 34 INFILE datafile LRECL = 20000 ; 35 36 attrib restatus length=3 label="Resdience Status"; 37 38 INPUT 39 @138 restatus 1. 40 ; 41 42 /*------------------------------------------------ 43 The PROC FORMAT statement will store the formats 44 in a sas data set called fnatl04 45 To use the stored formats in a subsequent program, 46 use code like the following: 47 48 proc format cntlin=library.fnatl04; 49 PROC freq; 50 tables sex ; 51 format sex sex.; 52 53 For more information, consult PROC FORMAT in the SAS Procedures Guide 54 ----------------------------------------------- */ 55 NOTE: The infile DATAFILE is: Pipe command="unzip -p /homes/nber/jroth/bulk/natl2004.zip " NOTE: 0 records were read from the infile DATAFILE. NOTE: The data set LIBRARY.NATL2004 has 0 observations and 1 variables. NOTE: DATA statement used (Total process time): real time 0.48 seconds cpu time 0.04 seconds 56 PROC FORMAT cntlout=library.fnatl04; 57 58 VALUE restat 59 1 = "RESIDENT: State and county of occurrence and residence are the same." 60 2 = "INTRASTATE NONRESIDENT: State of occurrence and residence are the same but county is different." 61 3 = "INTERSTATE NONRESIDENT: State of occurrence and residence are different but both are one of the 50 US states or 61 ! District of Columbia." 62 4 = "FOREIGN RESIDENT: The state of residence is not one of the 50 US states or District of Columbia." 63 ; NOTE: Format RESTAT has been output. 64 65 FORMAT 3 The SAS System 15:11 Tuesday, June 26, 2007 66 restatus restat. 67 ; 68 NOTE: The data set LIBRARY.FNATL04 has 4 observations and 21 variables. NOTE: PROCEDURE FORMAT used (Total process time): real time 0.10 seconds cpu time 0.04 seconds 69 proc freq data=library.&dataset.; 70 tables _all_ ; 71 FORMAT 72 restatus restat. 73 ; NOTE: No observations in data set LIBRARY.NATL2004. NOTE: PROCEDURE FREQ used (Total process time): real time 0.10 seconds cpu time 0.06 seconds NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414 NOTE: The SAS System used: real time 1.85 seconds cpu time 0.44 seconds