BookmarkSubscribeRSS Feed
Naiii
Fluorite | Level 6

Please, has anyone already noticed that SAS Viya makes calculation errors? For example, it calculates the total of 1+6 as 8. Any solutions, please?

8 REPLIES 8
JuanS_OCS
Amethyst | Level 16

Hello @Naiii ,

 

I personally would like to ask you to provide some evidence, specially when you raise such question or statement.

It would help us understand.

 

For example, the "error" you indicate, could be well a rounding up/down typical issue on the generation/definition of your report, which you could find in other applications, any, really. To give you a quick example, when the data is behind what is shown is 1.65 (just stripping all decimals or the cell is not large enough) and 6, the cells might show 1 and 6 but rounding up the total is 8 (when round up in totals/aggregation).

 

Looking forward to hearing back from you.

 

 

Sam_SAS
SAS Employee

Often what confuses people is that most visualizations display aggregated data, but calculations are evaluated at the row level. If you create a list table with "detail data" enabled, the values should look correct. Especially if you set the data format to display more decimal places.

 

Let us know if that helps to clear things up.

 

Sam

ballardw
Super User

Open your favorite speadsheet software.

Assign numeric display of a column to show no decimals.

Enter 1.45 in the first row

Enter 6.45 in the second row

Sum the two on row three in the same column.

Because you set the display limit to exclude decimals the cells will show 1, 6 and 8. The 8 is because the display rounded the actual summed value of 7.9 up to 8. Also why I picked values with .45 as the decimal portion as each of those gets rounded down.

 

So not just a SAS Viya behavior. This has been around for a very long time actually predating computers: when to round in calculations.

Patrick
Opal | Level 21

Just to add what already has been said.

data demo;
  a=10/3;
  b=10/3;
  c=10/3;
  total=sum(a,b,c);
run;

proc print data=demo;
  format _numeric_ f16.1;
run;

Patrick_0-1728012563451.png

 

Naiii
Fluorite | Level 6

The numbers do not contain decimals

Naima_elhmous_0-1728031411874.png

In that case, it sets total = 7.

Naima_elhmous_1-1728031541292.png

 

 

JuanS_OCS
Amethyst | Level 16

Hi @Naiii ,

 

yours is a visual representation. Any tool that does visual reporting has sometimes the challenge of visual representation vs data, in terms of decimals and aggregations.

 

I can observe you presented us with your visual representation in 2 separate screenshots, which tells me there i still more to this story. Either in the formulas or your data behind the scenes, and both need to be further understood.

If you still have doubts, I would strongly suggest to open a ticket with SAS Technical Support to analyze your report & data.

To answer your initial question, directly: I work with many clients and SAS deployments (Viya and not Viya), and while, as discussed above, you may experience these discrepancies in the visualization (as you can see in any other visualization tool), I have never seen this kind of issue with the data+calculations.

 

The responsibility of the visualization lays on the shoulders of the author of the report, except on very rare cases where there might a software defect, which I doubt very much is the case. Yet, if you want to challenge this aspect, SAS Technical Support will help you figure it out.

ballardw
Super User

@Naiii wrote:

The numbers do not contain decimals

Naima_elhmous_0-1728031411874.png

In that case, it sets total = 7.

Naima_elhmous_1-1728031541292.png

 

 


Pictures are not data, or very good proof of what values may be involved. Especially with what appears to be a very heavily edited picture.

 

 

Stu_SAS
SAS Employee

Can you change its format to Float12.2, then post a screenshot of the results? Visual Analytics uses the BEST12. format by default which may not necessarily include decimals.

 

Stu_SAS_0-1728321981398.png

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Tips for filtering data sources in SAS Visual Analytics

See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 8 replies
  • 998 views
  • 5 likes
  • 6 in conversation