I'm attempting to import data into SAS Enterprise Guide. The file is a csv originally generated by saving out an Excel doc on a Mac. There are three columns, Date, DayOfYear, and MonthOfYear.
My import code looks like this:
DATA indata;
INFILE '/sasdata/{path_to_file}' TERMSTR=cr DSD DLM=',';
INPUT Date YYMMDD10. DayOfYear MonthOfYear;
FORMAT Date YYMMDD10.;
RUN;
The problem is that this results in everything after the date column being shifted over by one column. Example output:
Date | DOY | MOY
2017-01-01 | | 1
2017-01-02 | | 2
2017-01-03 | | 3
My hacky solution has been to add an extra column named junk to get all the empty values, but I'd like to solve this for real if possible. Hack below.
DATA indata;
INFILE '/sasdata/{path_to_file}' TERMSTR=cr DSD DLM=',';
INPUT Date YYMMDD10. junk DayOfYear MonthOfYear;
FORMAT Date YYMMDD10.;
RUN;
Date | junk | DOY | MOY
2017-01-01 | | 1 | 1
2017-01-02 | | 2 | 1
2017-01-03 | | 3 | 1
I've tried messing with line feeds and carriage returns to no avail. I put in both DSD and DLM, but that doesn't change anything. It seems like the date has an extra invisible character at the end that's ending up in it's own column, but when I look at the data in a hex editor there's nothing there. For example
ef bb bf 32-30 31 37 2d-30 31 2d 30-31 2c 31 ...
It goes straight from 2017-01-01 to a comma to the 1. So there are no hidden characters. I'm not sure how else this could be happening. This is the second file I've had this issue with so I know it's not just a one off thing.
To summarize my question, how do I avoid creating a extra column just for junk after date variables?
INPUT Date: YYMMDD10.
? – Allan Bowe