LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (September 2008, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 15 Sep 2008 19:04:35 -0400
Reply-To:     Ya Huang <ya.huang@AMYLIN.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ya Huang <ya.huang@AMYLIN.COM>
Subject:      Re: Count number of unique values in a column vector in IML
Comments: To: "P. Cristian Gugiu" <crisgugiu@YAHOO.COM>

First time play around IML. I did find a function 'unique', and it seems to wrok fine:

proc iml; a={0 0 0 1 1 2 2 2}; print a; b=unique(a); print b; run;

a

0 0 0 1 1 2 2 2

b

0 1 2

On Mon, 15 Sep 2008 18:17:53 -0400, P. Cristian Gugiu <crisgugiu@YAHOO.COM> wrote:

>Hi all. I have a variable that represents the group an individual belogs >to. I would like to calculate the number of group levels by counting the >number of unique values for a variable in IML. For example, > >Variable X >0 >0 >0 >1 >1 >2 >2 >2 > >So, variable X has 3 group levels (0, 1, 2). Anyone know how to define a >variable that is equal to the number of unique values in X? > >thanks, >Cristian


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