12-07-2016 11:37 PM
Is there a way to tell the system which variable to read as character & which one as numeric/date. I have one numeric column with 13 digits, if I mention getnames=yes in proc import then it makes that column as numeric but values are junk. If I mention getnames=no in proc then it makes that as text.
Ideally I want it numeric with 13 digits but if that is not possible then I want it as text but with getnames.... Please send your expert advice........
12-07-2016 11:59 PM
You can't specify types with PROC IMPORT.
getnames should not make a difference. If you have column headers then use getnames, otherwise don't.
When you run proc import, check your log. It will have the data step code required to read the file.
Copy the code and modify as necessary to meet your requirements.
12-08-2016 04:57 AM
Yes, to add to what @Reeza has stated, proc import is a "guessing" procedure, it guesses what your data is. On the other you know what your data is. So who is best placed to define how the data should be imported? You are. You write the program, based on your import agreement (you do have one of those don't you), that imports the data in exact format/lengths - ejecting invalid data - and is then validated per your import process.
The emphasis at the end of the day is thay you are the data owner, therefore it is your responsibility for it.