BookmarkSubscribeRSS Feed
RahulG
Barite | Level 11

 

I am doing some calculation like 

 

data output;

set input;

A= (col1* col2*col3)/(100000*col4);

run;

 

My value in A is always less than 10,000 but when I am loading this output datasset in the  MS SQL table it is giving an error Numeric out of range.

One option is to increase the length of column in SQL table but I am looking for solution -  what should I do in data step so that data can be inserted into MS SQL table without getting an error. 

 

The place holder in MS SQL have sufficient length.

Seondly, I also tried using round function in data step but it didnt help.

4 REPLIES 4
ChrisBrooks
Ammonite | Level 13

You don't say what the number in col4 is but my guess is that once you multiply that by 100,000 you're exceeding the largest number that SQL Server can hold. A similar thing happened on one system I worked on with ORACLE. 

LinusH
Tourmaline | Level 20

What is your columns definition i SQL Server, and what values are rejected?

Data never sleeps
RahulG
Barite | Level 11

Existing definition - decimal(24,10)

 

When I changed to decimal(27,10) then it works.

 

I do not want to change the existing definition.

LinusH
Tourmaline | Level 20

Ok, not following. Either it fits, or not. Can't see that this is a SAS problem.

It seems that you either need to fix your data, or your columns definitions.

Data never sleeps

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