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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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