BookmarkSubscribeRSS Feed
deega
Quartz | Level 8

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........

2 REPLIES 2
Reeza
Super User

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. 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1270 views
  • 1 like
  • 3 in conversation