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 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Thu, 29 Jun 2006 05:31:43 -0700
Reply-To:     Irin later <irinfigvam@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Irin later <irinfigvam@YAHOO.COM>
Subject:      Re: how to calculate a count of members by categories while
              member id is a string?
Comments: To: toby dunn <tobydunn@hotmail.com>
In-Reply-To:  <BAY101-F27DE0DEEB7FBDE33CC80A1DE7C0@phx.gbl>
Content-Type: text/plain; charset=iso-8859-1

No, it is a numeric with decimal points:(

toby dunn <tobydunn@hotmail.com> wrote: Irin ,

If Allow_Amt is a character variable you need to first convert it to a numeric so the comparison will work in your if statements.

Toby Dunn

From: Irin later Reply-To: Irin later To: SAS-L@LISTSERV.UGA.EDU Subject: Re: how to calculate a count of members by categories while member id is a string? Date: Wed, 28 Jun 2006 19:29:15 -0700

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;

Thank you in advance

Irin

"Howard Schreier " 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.

--------------------------------- Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1&cent;/min.


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