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 (June 2006, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 28 Jun 2006 22:47:07 -0400
Reply-To:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject:   Re: how to calculate a count of members by categories while member id is a string?
Content-Type:   text/plain; charset=ISO-8859-1

On Wed, 28 Jun 2006 19:29:15 -0700, Irin later <irinfigvam@YAHOO.COM> wrote:

>Howard, > > My purpose is to calculate a number of patients according to the categories : > <$500 > $500-1000 > $1000-2000 > > > Will I meet it if I use ROUN function in the following? > > data HMOdolmed; > set HMOdolmed; > if round(allow-amt)<500 then medcat='<$500'; > else if 500<=round(allow_amt)<1000 then medcat='$500-$999'; > else if 1000<=round(allow_amt)<2000 then medcat='$1000-$1,999'; > run;

I don't know what your requirements are in this respect. It's been pointed out to you that the existing code is a little inattentive to detail when it comes to fractions of dollars near the boundaries.

Using ROUND essentially moves the cuts to 499.50, 999.50, and 1999.50. The rounded amounts will match the MEDCATs. Essentially, it sweeps the pennies under the rug. But again, while I know that ROUND is a tool which might be applicable, I have no way of determining if it's the right thing for your problem.

> > Thank you in advance > > Irin > >"Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM> wrote: > On Wed, 28 Jun 2006 16:37:54 -0700, Irin later wrote: > >>Toby, thank you for your method. It looks it works and categorises my Medcat. >> >> However the results of counting by categories (Medcat) makes me think >that assigning of categories is wrong >> That how I assigned medca before I used the code you provided me with: >> >> data HMOdolmed; >> set HMOdolmed; >> if allow-amt<500 then medcat='<$500'; >> else if 500<=allow_amt<1000 then medcat='$500-$999'; >> else if 1000<=allow_amt<2000 then medcat='$1000-$1,999'; >> run; >> >> I wonder if the decimal of allow_amt (for ex. it looks like numeric >500.25) could cause a wrong calculation results (I mean I summarise and get >more than total). How can I avoid this error ? > >I don't see a problem with 500.25, but your use of integer values in the >labels suggests that there are no values like 999.50. Perhaps you want to >change your labels. Another possibility is to use the ROUND function in the >comparisons. > >> >> Thank you in advance! >> >> Irin >> >> >> >> >>toby dunn wrote: >> Irin , >> >>Proc Means and SUmmary require variables of the Numeric persuasion. To get >>what you want try SQL: >> >>Proc SQL ; >>Create Table Out.MedCatHmoDol As >>Select MedCat , Count( Distinct Member) as NMember >>From HmoDolMed >>Group By MedCat ; >>Quit ; >> >> >> >> >> >>Toby Dunn >> >> >> >> >> >>From: Irin later >>Reply-To: Irin later >>To: SAS-L@LISTSERV.UGA.EDU >>Subject: how to calculate a count of members by categories while member id >>is a string? >>Date: Tue, 27 Jun 2006 12:20:04 -0700 >> >>I am trying to calculate count of members according to the certain >>categories. >>In other words I need to know how many distinct patients (whose IDs are >>of char data type) are under certain categories: >>Medcat= “$1000” >>Medcat=”$1000-2000” >>Medcat=”$2000-5000” >>I used proc summary below: >> >>Proc summary >>data = HMOdolMed; >>class Medcat ; >>var member; >>output out = out.MedcatHMOdol N(member) = NMember; >>run ; >>The error log told me the following: >> >>Proc summary >>54 data = HMOdolMed; >>55 class Medcat ; >>56 var member; >>ERROR: Variable MEMBER in list does not match type prescribed for this >>list. >>ERROR: Variable MEMBER in list does not match type prescribed for this >>list. >>ERROR: Variable MEMBER in list does not match type prescribed for this >>list. >>************************************************************************* >>Does it mean that var member (which is ID. Data type is character)should >>be numeric? >>If so…how can I resolve this problem (calc counts by categories)? >>Thank you in advance, >> >>Irin >> >> >> >>--------------------------------- >>Yahoo! Groups gets better. Check out the new email design. Plus there’s much >>more to come. >> >> >> >>--------------------------------- >>Do you Yahoo!? >> Get on board. You're invited to try the new Yahoo! Mail Beta. > > > >--------------------------------- >Do you Yahoo!? > Next-gen email? Have it all with the all-new Yahoo! Mail Beta.


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