Dear all,
I am new to SAS. I am trying to produce a table from simple data but the table output is incomplete. In the result viewer, the first column (DATE VAriable) is missing. I have to use the informat command. Can anyone please suggest me why i am not getting the result? Many thanks.
DATA PROB_4;
INPUT DATE 1-10 GENDER $ 11 AGE 12-13 SCORE 14-16;
INFORMAT DATE mmddyy10.;
DATALINES;
04/04/2004M15 90
05/12/2004F16 95
07/23/2004M18 88
01/20/2004F17100
;
RUN;
TITLE "Problem 4";
PROC PRINT DATA= PROB_4;
FORMAT DATE mmddyy10.;
RUN;
Since you specify the columns, the informat is not used.
And since you are reading a string into a numeric variable, missing values are generated.
Always look at the LOG. Always!
NOTE: Invalid data for DATE in line 30 1-10.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
30 04/04/2004M15 90
DATE=. GENDER=M AGE=15 SCORE=90 _ERROR_=1 _N_=1
NOTE: Invalid data for DATE in line 31 1-10.
31 05/12/2004F16 95
DATE=. GENDER=F AGE=16 SCORE=95 _ERROR_=1 _N_=2
NOTE: Invalid data for DATE in line 32 1-10.
32 07/23/2004M18 88
DATE=. GENDER=M AGE=18 SCORE=88 _ERROR_=1 _N_=3
NOTE: Invalid data for DATE in line 33 1-10.
33 01/20/2004F17100
DATE=. GENDER=F AGE=17 SCORE=100 _ERROR_=1 _N_=4
Since you specify the columns, the informat is not used.
And since you are reading a string into a numeric variable, missing values are generated.
Always look at the LOG. Always!
NOTE: Invalid data for DATE in line 30 1-10.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
30 04/04/2004M15 90
DATE=. GENDER=M AGE=15 SCORE=90 _ERROR_=1 _N_=1
NOTE: Invalid data for DATE in line 31 1-10.
31 05/12/2004F16 95
DATE=. GENDER=F AGE=16 SCORE=95 _ERROR_=1 _N_=2
NOTE: Invalid data for DATE in line 32 1-10.
32 07/23/2004M18 88
DATE=. GENDER=M AGE=18 SCORE=88 _ERROR_=1 _N_=3
NOTE: Invalid data for DATE in line 33 1-10.
33 01/20/2004F17100
DATE=. GENDER=F AGE=17 SCORE=100 _ERROR_=1 _N_=4
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.