2
votes

I am trying to import a csv file through the proc import function. I am using the following syntax:

PROC IMPORT OUT= WORK.claims 
        DATAFILE= 'C:\Folder\File.csv'
        DBMS=csv REPLACE;
        GETNAMES=YES;
        GUESSINGROWS=125;
RUN;

One of my variable is a character string of the following form: 15/04/2014AB280929D:01ABCDE. Thus it begins by a date, then 9 characters, a column and 7 characters.

The problem is that SAS detects this variable as a date and put a ddmmyy10 format on it. Then, when SAS tries to read the whole file I get errors on every line telling me that I have invalid data for this variable.

How can I fix this ?

1
To get more control over the import process, you could use a data-step instead.mjsqu

1 Answers

3
votes

Try using the File Import wizard from the menu instead. You'll get the same result initially, but you can then press F4 which will recall the last code submitted (in this case the code that import wizard runs in the background). You can then modify the informats and formats to suit your needs, then rerun the code.