|
I run the following code:
Proc SQL ;
Create Table MedCostPPO As
Select ETG_FAMILY,sum(allow_amt) as sumtot
From PPOcost
Group By ETG_FAMILY;
Quit;
Proc SQL ;
Create Table MedCostIND As
Select ETG_FAMILY, sum(allow_amt) as sumtot
From INDcost
Group By ETG_FAMILY;
Quit;
data IP;
set MedCostPPO MedCostIND;
run;
PROC SORT data=IP;
BY ETG_FAMILY;
run;
proc means data =IP noprint;
by ETG_FAMILY;
var sumtot;
output out=OUT.IP sum=sumtotFinal;
run;
Proc Rank data=OUT.IP Out=OUT.IP_ ties=low descending ;
var sumtotFinal;
Ranks rank_ALL;
Run;
…. and the output is totally unexpected.
I have beaten my head trying to resolve the problem. The thing is that after I created dataset IP by concatenating two data sets MedCostPPO MedCostIND I tried to sum their sumtot into sumtotFinal through PROC MEANS and then calculate a rank.
However the total sumtotFinal is NOT equal the sum of subtotals (sumtot from MedCostPPO plus sumtot from MedCostIND). It differs dramatically.
What I am doing wrong?
Thank you in advance!
Irin
---------------------------------
Yahoo! Music Unlimited - Access over 1 million songs.Try it free.
|