BookmarkSubscribeRSS Feed
keeevinr
Calcite | Level 5

Hello,

 

I am trying to output as much numeric values to be written on a Oracle table.

I tried using the format BEST32.20 on SAS Viya 4: SAS Studio. On the sample image, the View column is the source table from an Oracle table and the Stag column is the one written from SAS Studio to Oracle table. Is there any way SAS can write longer numeric values as the View?

I'm also wandering why the 2 values highlighted were different even they are the same column.

keeevinr_0-1680580089733.png

Sample Code with format:

keeevinr_1-1680580283357.png

 

Appreciate everyone's insights.

 

 

1 REPLY 1
ballardw
Super User

You want to read the SAS Online help about precision and storage of variables. Search for "Length and Precision of Variables". Basically it comes down to there is round off error in storage when you convert decimal values to binary. The more decimal places the more likely to see this artifact plus SAS basically only uses 14 or 15 significant digits. So your values are just to long to expect SAS to match. Though with the title of those variables as ratios I wonder if there is really any practical significance to holding that many decimals.

 

BEST format accepts a width, then places the digits as practical in that width. There is no decimal portion of the format. So if the value has a bunch of trailing zeroes after the smallest decimal that the BEST will attempt to display it stops. And basically just the significant digits. You could try something like a 32.30 format but that will have issues with values of 10 or greater as it only has the one integer digit position. And you will still have rounding differences.

 

Please post code or log entries as text in a text box opened on the forum with the </> icon that is above the message window. If we are to make suggestions to changed of code text it is not practical to expect us to completely retype your code. Text we can modify, pictures not so much.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 1 reply
  • 402 views
  • 0 likes
  • 2 in conversation