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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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