SAS User File for H120 Data This file contains information and sample SAS programs to create a permanent SAS dataset for users who want to use SAS in processing the MEPS data provided in this PUF release. There are two ways to create a permanent SAS dataset, using either the SAS transport data file (H120.SSP) or the ASCII data file (H120.DAT) supplied in this PUF release. Section A provides a sample SAS program for the first alternative, which is to convert the SAS transport data file to a regular SAS dataset using the SAS PROCedure: XCOPY. Section B provides a sample SAS program for the second alternative, which is to read data from the ASCII data file using a SAS DATA step with INFILE, INPUT, and LABEL statements. Section C explains format-related SAS statements that a user may optionally use when working with the SAS dataset. Examples of SAS programs (DATA step or PROC) are provided in all three sections, primarily for the benefit of inexperienced users. Section D contains complete SAS statements that must be used in the programs described in Sections B and C. INCLUDED BELOW ARE NOTES APPLICABLE TO USERS OF SAS VERSION 8 OR HIGHER. ****************************************************************************** The sample SAS programs provided in Sections A and B show how to create a permanent SAS dataset from the data files provided in this PUF release. A. A Sample SAS Program for Converting the SAS Transport File to a Permanent SAS Dataset The SAS PROCedure XCOPY will read a SAS transport file and convert the data to regular SAS format, storing the output in a permanent SAS dataset. This permanent SAS dataset can then be used for all future processing and analyses. Below is a sample SAS program that can be used to convert the SAS transport file to a permanent SAS dataset (in a Windows environment, with SAS V8 or higher). LIBNAME PUFLIB 'C:\MEPS\SASDATA'; FILENAME IN1 'C:\MEPS\DOWNLOAD\H120.SSP'; PROC XCOPY IN=IN1 OUT=PUFLIB IMPORT; RUN; SAS transport files, SAS data files, and SAS program files each should be stored in separate locations (directory names). Storing different types of SAS files in one location can cause errors with converting or retrieving data. Below are SAS statements to print a list of variables and a few sample records from the permanent SAS dataset: PROC CONTENTS DATA=PUFLIB.H120; TITLE 'List of Variables in MEPS H120 SAS Dataset'; RUN; PROC PRINT DATA=PUFLIB.H120 (OBS=20); TITLE 'First 20 Observations in MEPS H120 SAS Dataset'; RUN; The LIBNAME statement tells SAS the location (directory name) to store the permanent SAS dataset which is output by PROC XCOPY. The FILENAME statement tells SAS the location (complete directory and file name) of the input SAS transport data file. NOTES: 1) If you have an error reading a SAS data file you created, the problem may be a result of where you are storing and/or how you are retrieving the data. First check the data library for multiple releases of SAS files (e.g., V8 or higher with file extensions of '.SAS7BDAT' and V6 with file extensions of '.SD2') stored in the same location. a) You can avoid errors when reading these files by including the SAS release within the LIBNAME statement - e.g., LIBNAME PUFLIB V8 'C:\MEPS\SASDATA'; or b) Store SAS data files with different file extensions such as .SD2 and .SAS7BDAT, in separate folders (do not co-mingle V8 and V6 files in the same folder); or c) When importing transport files, output the SAS dataset to a different library than the one which contains the downloaded SAS transport file - e.g., LIBNAME PUFLIB 'C:\MEPS\SASDATA'; FILENAME IN1 'C:\MEPS\DOWNLOAD\Hxxx.SSP'; PROC XCOPY IN=IN1 OUT=PUBLIB IMPORT; RUN; 2) The names used in the LIBNAME and FILENAME statements shown above (i.e., PUFLIB, IN1) are arbitrary; they are only temporary aliases. 3) The directory and file names used in the LIBNAME and FILENAME statements shown above are Windows syntax and may need to be modified for other operating systems such as UNIX, MAC/OS, VMS, or OS/2. 4) H120 is the internal SAS dataset name (also the PC file name, without the extension) prior to the creation of the SAS transport data file. After running PROC XCOPY, the output SAS dataset assumes the same dataset name (or file name). Hence, in the example above, a file named H120.SAS7BDAT will be created under the C:\MEPS\SASDATA directory when PROC XCOPY runs successfully. 5) The SAS transport file H120.SSP was created from a SAS V9 data file, using PROC COPY. This file has been tested for use with SAS V8 or higher. This file may work with earlier versions of SAS, although it has not been tested with those versions. Users who are unable to use this SAS transport file should instead convert the ASCII data file H120.DAT to a SAS dataset as described in Section B. B. A Sample SAS Program for Converting the ASCII Data File to a Permanent SAS Dataset The complete SAS statements (INPUT and LABEL) included in Section D are intended to save time for those users wishing to create a permanent SAS dataset from the H120.DAT ASCII data file. These statements must be used in combination with other SAS statements to create the appropriate SAS program, as shown below. To use the statements provided in Section D to create a SAS program, you will need an ASCII text editor. If you are using an interactive form of SAS (Windows, UNIX, OS2, etc.), use the editor provided as part of the SAS software. Following is a sample SAS program that will convert the ASCII data file to SAS format: LIBNAME PUFLIB 'C:\MEPS\SASDATA'; FILENAME IN1 'C:\MEPS\DOWNLOAD\H120.DAT'; DATA PUFLIB.H120; INFILE IN1 LRECL=105; INPUT .....; * to user: insert the complete INPUT statement that is provided in Section D; LABEL .....; * to user: insert the complete LABEL statement that is provided in Section D; RUN; Here is an explanation of the SAS statements used in the program above. LIBNAME statement: This tells SAS the location (directory name) of the permanent SAS dataset. FILENAME statement: This tells SAS the location of the input ASCII data file. DATA statement: This signifies the beginning of a SAS DATA step and specifies the output SAS dataset, referencing the LIBNAME entry (PUFLIB) and assigning an internal SAS dataset name (H120). In the example, after the successful completion of the DATA step, a PC file named H120.SAS7BDAT would have been created in the C:\MEPS\SASDATA directory. INFILE statement: This tells SAS the location (directory and file name) of the input ASCII data file. Also provided is the logical record length (105 bytes), with the default of RECFM=V implied when this parameter is omitted. LRECL and RECFM are optional parameters in the INFILE statement. With regard to these options, please note the following: the ASCII data file H120.DAT contains a 2-byte carriage return/line feed at the end of each record. When converting to a PC-SAS file, the LRECL option should be used to specify the record length to avoid use of a default record length by PC-SAS. If the RECFM=V option is used, the LRECL option must be specified as the logical record length (e.g., 105 for H120.DAT). If RECFM=F is used, then the LRECL value must be specified as the logical record length plus 2 (107 for H120.DAT). Note that if the RECFM option is omitted, then the default option of RECFM=V is automatically used, and LRECL should be specified as the logical record (105 for H120.DAT). INPUT statement: This specifies the input record layout, giving names and the beginning and ending column positions for data items (which become SAS variables) in the ASCII data file (H120.DAT). Variable type (numeric or character) is also defined via the INPUT statement. LABEL statement: This associates descriptive names with the SAS variables. RUN statement: This tells SAS to execute all commands up to this point. See Section A.1 above for tips on retrieving and storing the permanent SAS data files. C. Optional Format-related SAS Statements If a user wants to use formats for the SAS variables, a SAS format library must first be created. Below is a SAS program that will accomplish this: LIBNAME PUFLIB 'C:\MEPS\SASDATA'; PROC FORMAT LIBRARY=PUFLIB; VALUE .....; * to user: insert the complete set of VALUE statements found in Section D; VALUE .....; .......... ; RUN; Below is an example of how to use the SAS formats defined by the PROC FORMAT procedure: LIBNAME PUFLIB 'C:\MEPS\SASDATA'; OPTIONS FMTSEARCH=(PUFLIB); PROC FREQ DATA=PUFLIB.H120; TABLES .... / LIST MISSING; FORMAT varnam1 fmtnam1. Varnam2 fmtnam2. .... ; * to user: substitute varnam1 and fmtnam1 with actual variable names and format names; * Insert the FORMAT statement provided in Section D, if you are using all the variables in the TABLES statement; TITLE 'Frequency Distributions ....'; RUN; Here is an explanation of the SAS statements used above. LIBNAME statement: This tells SAS the location (directory name) of the SAS format library. Please note that SAS datasets (file name extension is 'SAS7BDAT' for SAS V8 or higher and 'SD2' for SAS V6) and format libraries (file name extension is 'SAS7BCAT' for SAS V8 or higher and 'SC2' for SAS V6) can be stored under the same directory. OPTIONS FMTSEARCH=...: This specifies the SAS format library. PROC FORMAT statement: This identifies the SAS procedure that will make SAS formats according to VALUE statements. Formats will be stored in a file named FORMATS.SAS7BCAT. Please note that the option 'LIBRARY=...' can be omitted if the user does not want to create a permanent SAS format library. When simply 'PROC FORMAT;' is used, the formats are defined only for the duration of the batch SAS program or an interactive SAS session. VALUE statement: This gives a) names to formats; and b) descriptive labels for individual values, or range of values. The format names can then be invoked using a FORMAT statement if desired. PROC FREQ statement: This identifies the SAS procedure that generates frequency distributions of variables specified in the TABLES statement, formatted if a FORMAT statement is used. The input SAS dataset is specified in the 'DATA=' option. FORMAT statement: This associates existing formats with variables. When using this statement, the formats must have already been created with a PROC FORMAT procedure. RUN statement: This tells SAS to execute all commands up to this point. NOTES: 1) Use of formats is entirely optional, and depends on the types of analyses that you are doing. It is recommended that you create and use them as appropriate. 2) The names used in the LIBNAME and FILENAME statements shown above (i.e., PUFLIB, IN1) are arbitrary; they are only temporary aliases. 3) You only create the permanent SAS dataset once. Additional analyses can be run using this permanent dataset. 4) The file and directory specifications in the LIBNAME and FILENAME statements are Windows syntax and may need to be modified for other operating systems such as UNIX, MAC/OS, VMS, or OS/2. D. SAS Statements This section contains SAS INPUT, LABEL, FORMAT, and VALUE statements for use in converting the ASCII H120.DAT file into a SAS dataset, and for creating SAS formats. * INPUT STATEMENTS; INFILE IN LRECL=105; INPUT @1 DUID $5.0 @6 PID 3.0 @9 DUPERSID $8.0 @17 CONDN 3.0 @20 CONDIDX $12.0 @32 PANEL 2.0 @34 CONDRN 1.0 @35 PRIOLIST 1.0 @36 AGEDIAG 2.0 @38 REMISSN 2.0 @40 CRND1 2.0 @42 CRND2 2.0 @44 CRND3 1.0 @45 CRND4 2.0 @47 CRND5 2.0 @49 INJURY 1.0 @50 ACCDENTD 2.0 @52 ACCDENTM 2.0 @54 ACCDENTY 4.0 @58 ACCDNJAN 2.0 @60 ACCDNWRK 2.0 @62 MISSWORK 2.0 @64 MISSSCHL 1.0 @65 INBEDFLG 2.0 @67 ICD9CODX $3.0 @70 ICD9PROX $2.0 @72 CCCODEX $3.0 @75 HHNUM 2.0 @77 IPNUM 2.0 @79 OPNUM 3.0 @82 OBNUM 3.0 @85 ERNUM 2.0 @87 RXNUM 2.0 @89 PERWT08F 12.6 @101 VARSTR 4.0 @105 VARPSU 1.0 ; * FORMAT STATEMENTS; FORMAT DUID $DUID. PID PID. DUPERSID $DUPERSI. CONDN CONDN. CONDIDX $CONDIDX. PANEL PANELF. CONDRN CONDRN. PRIOLIST PRIOLIST. AGEDIAG AGEDIAGF. REMISSN REMISSNF. CRND1 CRND1F. CRND2 CRND2F. CRND3 CRND3F. CRND4 CRND4F. CRND5 CRND5F. INJURY INJURY. ACCDENTD ACCDENTD. ACCDENTM ACCDENTM. ACCDENTY ACCDENTY. ACCDNJAN ACDNJANF. ACCDNWRK ACCDNWRK. MISSWORK MISSWORK. MISSSCHL MISSSCHL. INBEDFLG INBEDFLG. ICD9CODX $ICD9COD. ICD9PROX $ICD9PRO. CCCODEX $CCCODEX. HHNUM HHNUM. IPNUM IPNUM. OPNUM OPNUM. OBNUM OBNUM. ERNUM ERNUM. RXNUM RXNUM. PERWT08F PERWT08F. VARSTR VARSTR. VARPSU VARPSU. ; * LABEL STATEMENTS; LABEL DUID ='DWELLING UNIT ID' PID ='PERSON NUMBER' DUPERSID='PERSON ID (DUID + PID)' CONDN ='CONDITION NUMBER' CONDIDX ='CONDITION ID' PANEL ='PANEL NUMBER' CONDRN ='CONDITION ROUND NUMBER' PRIOLIST='IS CONDITION ON PRIORITY LIST' AGEDIAG ='AGE WHEN DIAGNOSED' REMISSN ='IS CANCER IN REMISSION/UNDER CONTROL' CRND1 ='HAS CONDITION INFORMATION IN ROUND' CRND2 ='HAS CONDITION INFORMATION IN ROUND' CRND3 ='HAS CONDITION INFORMATION IN ROUND' CRND4 ='HAS CONDITION INFORMATION IN ROUND' CRND5 ='HAS CONDITION INFORMATION IN ROUND' INJURY ='WAS CONDITION DUE TO ACCIDENT/INJURY' ACCDENTD='DATE OF ACCIDENT -- DAY' ACCDENTM='DATE OF ACCIDENT -- MONTH' ACCDENTY='DATE OF ACCIDENT -- YEAR' ACCDNJAN='ACCIDENT/INJURY OCCUR BEFORE/AFTER JAN 1' ACCDNWRK='DID ACCIDENT OCCUR AT WORK' MISSWORK='FLAG ASSOCIATED WITH MISSED WORK DAYS' MISSSCHL='FLAG ASSOCIATED WITH MISSED SCHOOL DAYS' INBEDFLG='FLAG ASSOCIATED WITH BED DAYS' ICD9CODX='ICD-9-CM CODE FOR CONDITION - EDITED' ICD9PROX='ICD-9-CM CODE FOR PROCEDURE - EDITED' CCCODEX ='CLINICAL CLASSIFICATION CODE - EDITED' HHNUM ='# HOME HEALTH EVENTS ASSOC. W/ CONDITION' IPNUM ='# INPATIENT EVENTS ASSOC. W/ CONDITION' OPNUM ='# OUTPATIENT EVENTS ASSOC. W/ CONDITION' OBNUM ='# OFFICE-BASED EVENTS ASSOC W/ CONDITION' ERNUM ='# ER EVENTS ASSOC. W/ CONDITION' RXNUM ='# PRESCRIBED MEDICINES ASSOC. W/ COND.' PERWT08F='EXPENDITURE FILE PERSON WEIGHT, 2008' VARSTR ='VARIANCE ESTIMATION STRATUM, 2008' VARPSU ='VARIANCE ESTIMATION PSU, 2008' ; * VALUE STATEMENTS; VALUE ACCDENTD -9 = '-9 NOT ASCERTAINED' -8 = '-8 DK' -7 = '-7 REFUSED' -1 = '-1 INAPPLICABLE' 1 - 31 = '1 - 31' ; VALUE ACCDENTM -9 = '-9 NOT ASCERTAINED' -8 = '-8 DK' -7 = '-7 REFUSED' -1 = '-1 INAPPLICABLE' 1 - 12 = '1 - 12' ; VALUE ACCDENTY -9 = '-9 NOT ASCERTAINED' -8 = '-8 DK' -7 = '-7 REFUSED' -1 = '-1 INAPPLICABLE' 1926 - 2005 = '1926 - 2005' 2006 = '2006' 2007 = '2007' 2008 = '2008' 2009 = '2009' ; VALUE ACCDNWRK -9 = '-9 NOT ASCERTAINED' -8 = '-8 DK' -7 = '-7 REFUSED' -1 = '-1 INAPPLICABLE' 1 = '1 YES' 2 = '2 NO' 3 = '3 DOES NOT WORK' ; VALUE ACDNJANF -9 = '-9 NOT ASCERTAINED' -8 = '-8 DK' -7 = '-7 REFUSED' -1 = '-1 INAPPLICABLE' 1 = '1 BEFORE' 2 = '2 AFTER' ; VALUE AGEDIAGF -9 = '-9 NOT ASCERTAINED' -8 = '-8 DK' -7 = '-7 REFUSED' -1 = '-1 INAPPLICABLE' 0 - 85 = '0 - 85 AGE WHEN DIAGNOSED' ; VALUE $CCCODEX '-1' = '-1 INAPPLICABLE' '-9' = '-9 NOT ASCERTAINED' '001' - '064' = '001 - 064' '076' - '259' = '076 - 259' '650' - '670' = '650 - 670' ; VALUE $CONDIDX '0' < - HIGH = 'VALID ID' ; VALUE CONDN 11 - 481 = '11 - 481' ; VALUE CONDRN 1 = '1 ROUND 1' 2 = '2 ROUND 2' 3 = '3 ROUND 3' 4 = '4 ROUND 4' 5 = '5 ROUND 5' ; VALUE CRND1F -1 = '-1 INAPPLICABLE' 0 = '0 NO' 1 = '1 YES' ; VALUE CRND2F -1 = '-1 INAPPLICABLE' 0 = '0 NO' 1 = '1 YES' ; VALUE CRND3F -1 = '-1 INAPPLICABLE' 0 = '0 NO' 1 = '1 YES' ; VALUE CRND4F -1 = '-1 INAPPLICABLE' 0 = '0 NO' 1 = '1 YES' ; VALUE CRND5F -1 = '-1 INAPPLICABLE' 0 = '0 NO' 1 = '1 YES' ; VALUE $DUID '0' < - HIGH = 'VALID ID' ; VALUE $DUPERSI '0' < - HIGH = 'VALID ID' ; VALUE ERNUM 0 = '0' 1 - 10 = '1 - 10' ; VALUE HHNUM 0 = '0' 1 - 32 = '1 - 32' ; VALUE $ICD9COD '-1' = '-1 INAPPLICABLE' '-9' = '-9 NOT ASCERTAINED' '001' - '139' = '001 - 139' '140' - '239' = '140 - 239' '240' - '279' = '240 - 279' '280' - '289' = '280 - 289' '290' - '319' = '290 - 319' '320' - '389' = '320 - 389' '390' - '459' = '390 - 459' '460' - '519' = '460 - 519' '520' - '579' = '520 - 579' '580' - '629' = '580 - 629' '630' - '677' = '630 - 677' '680' - '709' = '680 - 709' '710' - '739' = '710 - 739' '740' - '759' = '740 - 759' '760' - '779' = '760 - 779' '780' - '799' = '780 - 799' '800' - '999' = '800 - 999' 'E90' - 'E98' = 'E90 - E98' 'V01' - 'V85' = 'V01 - V85' ; VALUE $ICD9PRO '-1' = '-1 INAPPLICABLE' '-9' = '-9 NOT ASCERTAINED' '00' - '05' = '00 - 05' '06' - '07' = '06 - 07' '08' - '16' = '08 - 16' '18' - '20' = '18 - 20' '21' - '29' = '21 - 29' '30' - '34' = '30 - 34' '35' - '39' = '35 - 39' '40' - '41' = '40 - 41' '42' - '54' = '42 - 54' '55' - '59' = '55 - 59' '60' - '64' = '60 - 64' '65' - '71' = '65 - 71' '72' - '75' = '72 - 75' '76' - '84' = '76 - 84' '85' - '86' = '85 - 86' '87' - '99' = '87 - 99' ; VALUE INBEDFLG -9 = '-9 NOT ASCERTAINED' 0 = '0 NO' 1 = '1 YES' ; VALUE INJURY -9 = '-9 NOT ASCERTAINED' 1 = '1 YES' 2 = '2 NO' ; VALUE IPNUM 0 = '0' 1 - 10 = '1 - 10' ; VALUE MISSSCHL -9 = '-9 NOT ASCERTAINED' 0 = '0 NO' 1 = '1 YES' ; VALUE MISSWORK -9 = '-9 NOT ASCERTAINED' 0 = '0 NO' 1 = '1 YES' ; VALUE OBNUM 0 = '0' 1 - 211 = '1 - 211' ; VALUE OPNUM 0 = '0' 1 - 156 = '1 - 156' ; VALUE PANELF 12 = '12 PANEL 12' 13 = '13 PANEL 13' ; VALUE PERWT08F 0 = '0.000000 WEIGHT' 586.318367 - 69862.000852 = '549.676599 - 67153.732784 WEIGHT' ; VALUE PID 0 < - HIGH = 'VALID ID' ; VALUE PRIOLIST 1 = '1 YES' 2 = '2 NO' ; VALUE REMISSNF -9 = '-9 NOT ASCERTAINED' -8 = '-8 DK' -7 = '-7 REFUSED' -1 = '-1 INAPPLICABLE' 1 = '1 YES' 2 = '2 NO' ; VALUE RXNUM 0 = '0' 1 - 30 = '1 - 30' ; VALUE VARPSU 1 - 3 = '1 - 3' ; VALUE VARSTR 1001 - 1165 = '1 - 1165' ;