Data visualization with SAS programming

please explain the error

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 91
Accepted Solution

please explain the error

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;

Attachment

Accepted Solutions
Solution
‎11-10-2012 10:53 AM
Esteemed Advisor
Posts: 6,919

Re: please explain the error

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


All Replies
Solution
‎11-10-2012 10:53 AM
Esteemed Advisor
Posts: 6,919

Re: please explain the error

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.

Frequent Contributor
Posts: 91

Re: please explain the error

Thank you very much!

Super Contributor
Super Contributor
Posts: 422

Re: please explain the error

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

Esteemed Advisor
Posts: 6,919

Re: please explain the error

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

Super Contributor
Super Contributor
Posts: 422

Re: please explain the error

right! Totally confused them .Thank you though

Post a Question
Discussion Stats
  • 5 replies
  • 259 views
  • 5 likes
  • 3 in conversation