01-29-2013 04:34 AM
I am importing an Excel file data into a Sas data set.
Excel file has basically two columns one with numeric data type and one with character data. In few files both are numeric or both character too.
But in Sas data set it always coming as charecter data type. My requirement is if it's numeric in Excel than it should be Numeric in Sas data and if it's Charecter than it should charecter in Sas data after imported.
01-29-2013 08:37 AM
SAS imports as character because there are both numeric and character cells in the same column of your Excel file. If you clear the format of your excel file you would see all the character cells moving to the right.
01-29-2013 10:24 AM
Longer but you have more control is to save the Excel file as CSV and then import that. There will be data step code generated in the log that can be copied and modified to provide much more control than proc import allows for excel files such as custom informats, length of character variables, assigning labels. Also additional calculations or custom warnings for data ranges can be added to the code.
Since I deal with entry people who will type 'Missing' into a cell that is supposed to be numeric or a value plus text such as "100 weekly" I find this approach more effective in the long run.