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-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!

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.

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