```Date: Wed, 21 Feb 2001 08:42:54 -0800 Reply-To: "William W. Viergever" Sender: "SAS(r) Discussion" From: "William W. Viergever" Subject: Re: calculating percents Comments: To: Eileen_Farrelly@PCIT.COM In-Reply-To: Content-Type: text/plain; charset="us-ascii"; format=flowed At 10:54 AM 2/21/2001 -0500, Eileen Farrelly 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? > >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. So why don't you do just that. Simply bring in the total cost from the means (read up on using 2 set statements) and then run your formula above? And if you don't *know* the total pop, calculate that in a similar manner and then bring 'em all together. HTH ---------------------------------------------------------------------------- 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