Date: Wed, 21 Feb 2001 09:11:05 -0800 "William W. Viergever" "SAS(r) Discussion" "William W. Viergever" Re: calculating percents To: Abelson_R <7864A9839E95D4119A8F00508BAED813487174@dcpcsmail1.psb.bls. gov> text/plain; charset="us-ascii"; format=flowed

Robert:

Er, em .... me thinks your TOTPOP is not what you think it is; i.e., it simply is the total number of folks who had a claim - not necessarily the total pop. The PMPM numerator is cool, however.

FWIW, I've seen populations where the proportion of those who received service varies from the 20%'s (young "N healthy) to the 60%'s/70%'s (retired folks, or chronically ill pops).

BTW, *if* you had already brought TOTALPOP into Data One (as a scalar on every OBS) then you could do what you've written, except that you'd want to do MEAN=TOTPOP and not N= in the Proc Summary.

HTH

At 11:58 AM 2/21/2001 -0500, Abelson_R wrote: >Eileen, > >You don't need a macro variable to get a denominator. There are many ways >to do this, here's one (tested with your data): > >proc summary data=one; > class ptid; > var cost; > output out=pats n=totpop sum=costsum; >run; > >proc sql; > create table newpats as > select ptid, costsum, totpop, (costsum/12)/totpop as pmpm > from pats > where ptid is not null > group by ptid; >quit; > >proc print data=newpats; > var ptid costsum totpop pmpm; >run; > >I get: > OBS PTID COSTSUM TOTPOP >PMPM > > 1 1 154.46 3 >4.29056 > 2 2 120.40 2 >5.01667 > 3 3 151.28 3 >4.20222 > >HTH. > >Robert Abelson >Bureau of Labor Statistics >abelson_r@bls.gov >"The generation of random numbers is too important to be left to chance." >-- Robert R. Coveyou, Oak Ridge National Laboratories > > >-----Original Message----- >From: Eileen Farrelly [mailto:Eileen_Farrelly@PCIT.COM] >Sent: Wednesday, February 21, 2001 10:54 AM >To: SAS-L@LISTSERV.UGA.EDU >Subject: calculating percents > > >I would like to fully automate the following: > >I am calculating the percentage of patients for whom I have data on over >the total population of the plan and I am calculating the per Member per >Month cost (PMPM) (for a particular class of drugs). > >Among other variables I have the following: > >ptid date drug cost >1 01/01/99 A 63.50 >1 02/01/99 A 63.50 >1 03/01/99 B 27.46 >2 02/03/99 C 45.20 >2 06/05/99 D 75.20 >3 08/02/99 A 57.64 >3 09/01/99 A 58.64 >3 10/11/99 B 35.00 > >Although it is not in the data, I know the plan's total population to be >(example) =50. > >I can get the number of unique patients using the following: > >data unique; > set one; > by ptid; > if first.ptid; >run; > >But then I have to calculate the percentage of unique patients over the >total plan membership with my calculator - is there a way (using a macro?) >that I can get the number of unique patients and divide it by the total >plan population? > >I have the same issue with calculating the PMPM. >The formula is : > PMPM=((SUM cost)/12) > / plan's total population > >I can get the SUM of the costs using proc means but then I have to use the >calculator to divide that by 12 and then divide by the total plan >population. > >I am trying to automate things so that SAS will directly output the >computed values for me. > >Thanks in advance!! > >Eileen

---------------------------------------------------------------------------- William W. Viergever Voice : (916) 483-8398 Viergever & Associates Fax : (916) 486-1488 Sacramento, CA 95835 E-mail : wwvierg@ibm.net ----------------------------------------------------------------------------

Back to: Top of message | Previous page | Main SAS-L page