options nocenter validvarname=any; *---Read in space-delimited ascii file; data new_data; infile 'Child2008_TemperamentAddedScores.dat' lrecl=16 missover DSD DLM=' ' print; input C0000100 C3953400 C3953500 ; array nvarlist _numeric_; *---Recode missing values to SAS custom system missing. See SAS documentation for use of MISSING option in procedures, e.g. PROC FREQ; do over nvarlist; if nvarlist = -1 then nvarlist = .R; /* */ if nvarlist = -2 then nvarlist = .D; /* */ if nvarlist = -3 then nvarlist = .I; /* */ if nvarlist = -7 then nvarlist = .M; /* */ end; label C0000100 = "CHILD ID CODE NUMBER"; label C3953400 = "TEMPERAMENT: ACTIVITY RAW SCORE 2008"; label C3953500 = "TEMPERAMENT: PREDICT RAW SCORE 2008"; /*---------------------------------------------------------------------* * Crosswalk for Reference number & Question name * *---------------------------------------------------------------------* * Uncomment and edit this RENAME statement to rename variables * for ease of use. You may need to use name literal strings * e.g. 'variable-name'n to create valid SAS variable names, or * alter variables similarly named across years. * This command does not guarentee uniqueness * See SAS documentation for use of name literals and use of the * VALIDVARNAME=ANY option. *---------------------------------------------------------------------*/ /* *start* */ * RENAME C0000100 = 'CPUBID'n C3953400 = 'ACTVTY2008'n C3953500 = 'PREDCT2008'n ; /* *finish* */ run; proc means data=new_data n mean min max; run; /*---------------------------------------------------------------------* * FORMATTED TABULATIONS * *---------------------------------------------------------------------* * You can uncomment and edit the PROC FORMAT and PROC FREQ statements * provided below to obtain formatted tabulations. The tabulations * should reflect codebook values. * * Please edit the formats below reflect any renaming of the variables * you may have done in the first data step. *---------------------------------------------------------------------*/ /* proc format; value vx0f 1-99999999='1 TO 99999999: Child ID Code' ; value vx1f 0='0' 1-4='1 TO 4' 5-9='5 TO 9' 10-14='10 TO 14' 15-19='15 TO 19' 20-999='20 TO 999' ; value vx2f 0='0' 1-4='1 TO 4' 5-9='5 TO 9' 10-14='10 TO 14' 15-19='15 TO 19' 20-999='20 TO 999' ; */ /* *--- Tabulations using reference number variables; proc freq data=new_data; tables _ALL_ /MISSING; format C0000100 vx0f.; format C3953400 vx1f.; format C3953500 vx2f.; run; */ /* *--- Tabulations using default named variables; proc freq data=new_data; tables _ALL_ /MISSING; format CPUBID vx0f.; format ACTVTY2008 vx1f.; format PREDCT2008 vx2f.; run; */