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

I am trying to import the column in the attached file into SAS; I have been using the following code and I am getting an error in the input line. I am using SAS 9.2; could someone provide some insight as to why this doesn't work?

data WORK.NCDebt;

     infile '/SourcePath/Example.csv';

informat Maturity yymmdd8.;

format Maturity yymmdd8.;

input Maturity :yymmdd8.;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Your dates should be read with a mmddyy informat. The while 5 might pass as a year 15 is not a month (the MM part) and 2014 is right out for the day of the month.

and why make an attachment instead of posting:

5/15/2041

5/15/2039

5/15/2038

5/15/2021

5/15/2020

7/2/2015

1/20/2015

11/20/2014

9/16/2014

9/15/2016

View solution in original post

2 REPLIES 2
ballardw
Super User

Your dates should be read with a mmddyy informat. The while 5 might pass as a year 15 is not a month (the MM part) and 2014 is right out for the day of the month.

and why make an attachment instead of posting:

5/15/2041

5/15/2039

5/15/2038

5/15/2021

5/15/2020

7/2/2015

1/20/2015

11/20/2014

9/16/2014

9/15/2016

Hima
Obsidian | Level 7

DATA WORK.Example1;

    LENGTH

        F1                 8 ;

    FORMAT

        F1               YYMMDD8. ;  /** CHANGE THE FORMAT AS YOU NEED TO DISPLAY OUTPUT */

    INFORMAT

        F1               YYMMDD10. ;

    INFILE 'xxxxx/Example.csv'

        LRECL=10

        ENCODING="LATIN1"

        TERMSTR=CRLF

        DLM='7F'x

        MISSOVER

        DSD ;

    INPUT

        F1               : ?? MMDDYY10. ;

RUN;

Capture.JPG

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
  • 2 replies
  • 426 views
  • 3 likes
  • 3 in conversation