Date: Mon, 5 Dec 2005 12:36:12 -0500
Reply-To: "Michael F. Murphy" <Michael.F.Murphy@KP.ORG>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Michael F. Murphy" <Michael.F.Murphy@KP.ORG>
Subject: Help Needed on SQL Code
In my example, there are two data sets, one showing cost by MedGp and the
other showing the number of enrollees. The task is to compute average costs
(AvgCost) based upon the number of enrollees, as shown in the second table.
The code MUST be in sql.
I assume that this is possible using a subquery, but I have not found a
way to do this. Although the solution is easy using standard SAS code, I
have not found a way to do this using PROC SQL.
Any suggestions?
MedGp costs
1 312800
2 1352490
3 368880
4 88320
5 802650
6 652710
7 1736730
8 906980
9 1051880
10 1034350
11 628720
12 361830
13 1447380
14 132530
15 40430
16 1218940
17 1406440
18 2101310
19 2075450
Enrollees = 456
MedGp AvgCost
1 685.96
2 2965.99
3 808.95
4 193.68
5 1760.20
6 1431.38
7 3808.62
8 1988.99
9 2306.75
10 2268.31
11 1378.77
12 793.49
13 3174.08
14 290.64
15 88.66
16 2673.11
17 3084.30
18 4608.14
19 4551.43
|