@s_lassen wrote:
Yes, @Kurt_Bremser is right. When it comes to .csv-files, it is much better to use data-step code than PROC IMPORT. You do not have to write the whole data step yourself, though. After submitting PROC IMPORT, you can use the RECALL command once in a text editor window, or scrape the generated data step code from the log window. You will then have not the PROC IMPORT code, but the data step code that PROC IMPORT generated. Adapt that changing the names of variables (and possibly other stuff), and save the code. You will then have something that gives similar data type results every time, even if the input data varies (PROC IMPORT guesses the types of the variables by looking at the file).
If your data source is nice there should be some documentation as to maximum length of character variables, how date, time or datetime values will appear, and such. So you can adjust the generated code to match so later files with different values don't get truncated.
One recurring theme: identification variables consisting of digits: account numbers, bank routing numbers, part numbers and such likely should be character values. Otherwise you may lose things like important leading zeroes or exceed the storage precision of numbers.
... View more