BookmarkSubscribeRSS Feed
acemanhattan
Quartz | Level 8

Why would the difference between these two pieces of code cause the aggregate sum of all observations' mmos to be different?

I understand that we shouldn't expect the observations to individually be the same, but shouldn't the aggregate totals be?s

proc summary noprint missing nway data=v_mmr_&state;

Class inc_year lob plan_number SCC tin tin_nm_rllp stat;

Var mmos_:;

output out=mmrsum_&state (drop=_type_ _freq_) sum=;

quit;


proc summary noprint missing nway data=v_mmr_&state;

Class inc_year lob plan_number SCC tin tin_nm_rllp stat current_ctg yearmo;

Var mmos_:;

output out=mmrsum_&state (drop=_type_ _freq_) sum=;

quit;

3 REPLIES 3
Astounding
PROC Star

The totals should be the same, sort of.  A couple of related questions, though:

How different are they?

How many observations are there in each output data set?

Since you're already using the MISSING option, I would suspect this is a matter of floating point arithmetic.  Adding up imprecisely stored sets of values should get very nearly (but not necessarily exactly) the same total.

Good luck.

JamesM1962
Calcite | Level 5

Do you have missing values in current_ctg and/or yearmo?

acemanhattan
Quartz | Level 8

So I think the issue is that when I tried to compare the two datasets in Excel, the first dataset is small enough for Excel but the second one isn't.

When I compare them in SAS they end up being the same.

sas-innovate-white.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Early bird rate extended! Save $200 when you sign up by March 31.

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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