BookmarkSubscribeRSS Feed
deleted_user
Not applicable
We have a batch process that imports a large number of EXCEL workbooks.
Sometimes a field which ought to be numeric contains character data.
This error stops the entire process.
We would like to be able to note/trap the error and continue importing the rest of the workbooks.

How can we achieve this?

Thanks in Advance
3 REPLIES 3
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Are you using SAS PROC IMPORT or are you using some DATA step or another technique to "import" your data to SAS? You can always use INFILE/INPUT processing, input the field as CHARACTER, test it using an ANYxxxxx type function and execute accordingly as you prescribe in your program.

Scott Barry
SBBWorks, Inc.
ChrisNZ
Tourmaline | Level 20
As Scott says, the usual way to do this is to
- read values into temp character variables,
- test the validity of the values,
- convert to numeric and drop temp character variables,
- save.
Flip
Fluorite | Level 6
You need to code error handling routines to trap and reset error codes to let your process continue. I found several papers that my help you for instance
http://www.nesug.org/proceedings/nesug05/ap/ap9.pdf

Google "error handling sas"

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
  • 3 replies
  • 1010 views
  • 0 likes
  • 4 in conversation