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:35:29 -0500
Reply-To:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Gerhard Hellriegel <ghellrieg@T-ONLINE.DE>
Subject:   Re: calculating percents

On Wed, 21 Feb 2001 10:54:18 -0500, 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? > >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

Hi Eileen, both should be very easy. I might not understand exactly what you want, but the first:

You can get summaries with PROC SUMMARY. If you don't use the NWAY option you can select all aggregation levels with the _TYPE_ variable. The _TYPE_=0 level is over the whole dataset. So a

data _null_; set sum; where _type_=0; call symput("all",_freq_); or another variable where a sum over the whole data is contained... run;

will give it to you in the macro variable &all

This variable you can use in each data step to calculate anything you want!

e.g use your formula:

PMPM=SUM_cost/12/&all;


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