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

Hi,

 

Just experimenting with very basic raw data reading and I'm getting stumped with this error.

Any insight or help will be appreciated

The error shows the program I am running .. the raw data is 24/12/1856765 

The first 8 characters is the date 24/12/18 i am trying to read with the informat ddmmyy8. but its throwing an error

 

 

1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
72
73 data test;
74 input date :ddmmyy8. @9 amount;
75 format date date9. amount dollar16.2;
76 cards;
 
NOTE: Invalid data for date in line 77 1-13.
RULE: ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----
77 24/12/1856765
date=. amount=$56,765.00 _ERROR_=1 _N_=1
NOTE: The data set WORK.TEST has 1 observations and 2 variables.
NOTE: DATA statement used (Total process time):
 
 
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

By using the colon modifier you told SAS to read all of the characters up to the next delimiter (or end of line) using the MMDDYY informat.

Note that in list mode the INPUT statement ignores the width on the informat and uses the width of the actual next word of data.  SAS cannot make a date value with a year of 1,856,765.

 

Just remove the : from the INPUT statement.

 

View solution in original post

3 REPLIES 3
novinosrin
Tourmaline | Level 20

Can you paste the datalines as well plz?

 

I can't see the data

 

 

data test;
input date ddmmyy8.  amount;
format date date9. amount dollar16.2;
cards;
24/12/1856765
;
Tom
Super User Tom
Super User

By using the colon modifier you told SAS to read all of the characters up to the next delimiter (or end of line) using the MMDDYY informat.

Note that in list mode the INPUT statement ignores the width on the informat and uses the width of the actual next word of data.  SAS cannot make a date value with a year of 1,856,765.

 

Just remove the : from the INPUT statement.

 

jfaruqui
Obsidian | Level 7

Thanks guys ... silly silly mistake ..

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 552 views
  • 1 like
  • 3 in conversation