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

Hi,

I used the following code to call the attached data set. When i checked the log file I noticed something wasn't right.( Error was about INVALID DATA)

Should I worry about this or is there a way to correct it.

Thanks.

data test;

  infile "F:\data\ftse.csv"  DSD MISSOVER;

  input Date Close adjclose returns dm dt dw dh df;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
art297
Opal | Level 21

There are at least three errors, two in the program and one in the file.

In your code you are not accounting for the fact that the datafile has a header record, nor are you accounting for the fact that the first field is a date field.

I think you'll find that the following would work a lot better:

options datestyle=mdy;

data test;

  infile "f:\data\ftse.csv"  DSD MISSOVER firstobs=2;

  informat date anydtdte10.;

  input Date Close adjclose returns dm dt dw dh df;

run;

As for the datafile's header record, there is a problem with it and I would ask the supplier to correct it.  There are two dt fields identified, thus one doesn't know which contains the right data.  You called the second one df, in your code, thus you may already know about the discrepancy.

View solution in original post

5 REPLIES 5
art297
Opal | Level 21

There are at least three errors, two in the program and one in the file.

In your code you are not accounting for the fact that the datafile has a header record, nor are you accounting for the fact that the first field is a date field.

I think you'll find that the following would work a lot better:

options datestyle=mdy;

data test;

  infile "f:\data\ftse.csv"  DSD MISSOVER firstobs=2;

  informat date anydtdte10.;

  input Date Close adjclose returns dm dt dw dh df;

run;

As for the datafile's header record, there is a problem with it and I would ask the supplier to correct it.  There are two dt fields identified, thus one doesn't know which contains the right data.  You called the second one df, in your code, thus you may already know about the discrepancy.

malakaext
Calcite | Level 5

Thank you very much!

Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

doesnt he also have to declare the lrecl=5558 as the number of records is close to this number?

art297
Opal | Level 21

: No.  lrecl is for individual record length not number of records.

Tal
Pyrite | Level 9 Tal
Pyrite | Level 9

right! Totally confused them .Thank you though

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 5 replies
  • 1323 views
  • 5 likes
  • 3 in conversation