0
votes

I am trying to import a CSV into SAS using proc import. When running this code , it states that there is invalid data in two columns, column x and column y. It appears it may be reading the columns as numeric, and then sending the error when letters appear. The error message sends me to lines where letters first appear in these two columns.

Do I need to define the format for these two columns?

This is a large data set with 100+ columns, only two columns give me an error.

proc import
datafile = 'filepath'
out = dataname
dbms = CSV
replace
;

Hoping to receive output without these error messages:

NOTE: Invalid data for Column Y in line 472 46-47.

WARNING: Limit set by ERRORS= option reached. Further errors of this type will not be printed.

ERROR: Import unsuccessful. See SAS Log for details.

1

1 Answers

0
votes

It could be that SAS misidentified those columns. Since you are importing a CSV, check the log. It will output SAS Data Step code that you can use to change the column type. Usually this happens because SAS identified a column as numeric, but some lines contain characters.

You can modify the data step code directly for those columns, or you can add the guessingrows= option to proc import to increase the accuracy of identifying a column type. This will decrease performance significantly if you make the size too large. Start with 500, then increase from there as needed.