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

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