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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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