BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Stdt
Calcite | Level 5

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;

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisNZ
Tourmaline | Level 20

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

View solution in original post

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 561 views
  • 1 like
  • 2 in conversation