Add an ALLCHAR option to the PROC IMPORT statement -- to import all variables as character.
This should apply to external text files and to Excel files (considering CSV files to be text files)
This should not apply to external databases because they usually have metadata with predefined data-types.
The current situation is somewhat uncomfortable.
The best option is to avoid PROC IMPORT in favor of the Libname statement with dbSAStype. This allows us to specify which fields should be character, but we have to specify each field individually.
Another option is to use the Libname statement with Mixed=Yes, but this works only for columns that contain both numbers and words.
These discussions would probably benefit from the ability to import all variables as character:
Reading in all numeric variables as character variables from .csv files
Proc import excel - Default character
How to get SAS to import MS xlsx files with date fields as all numeric (or all character)
PROC IMPORT from Excel: how to ensure consistent types and formats for each data column
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.