LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (February 2001, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 21 Feb 2001 12:51:45 -0500
Reply-To:   Klaus Lemke <klemke@JHSPH.EDU>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Klaus Lemke <klemke@JHSPH.EDU>
Subject:   Re: calculating percents
Comments:   cc: Eileen_Farrelly@PCIT.COM
In-Reply-To:   <200102211601.LAA02159@ens1.is.jhsph.edu>
Content-Type:   text/plain; charset="us-ascii"; format=flowed

Eileen Farrelly <Eileen_Farrelly@PCIT.COM> wrote:

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

proc sql; count ptid into :tot_pop from one; /* stores total population count into macro variable tot_pop */

count distinct ptid into :tot_pop_uni from one: /* stores number of unique patients into macro variable tot_pop_uni */ quit;

%put tot_pop_uni/tot_pop;

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

output the sum into a dataset and divide by the total population: proc summary data=one; var cost; output out=two sum=; run; data two; set two; pmpm=(cost/12)/&tot_pop; run;

>I am trying to automate things so that SAS will directly output the >computed values for me.

One thing to consider is that your calculation assumes 12 month enrollees. Persons with less than a full year of enrollment should have their costs annualized and the sum calculation should be weighted by months of enrollment.

Klaus Lemke Johns Hopkins School of Public Health


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