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 (August 2008, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 6 Aug 2008 13:49:50 -0700
Reply-To:     "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject:      Re: order/count question
Comments: To: SUBSCRIBE SAS-L Anonymous <lqiantobe22@YAHOO.COM>
In-Reply-To:  A<200808062004.m76HTtBg027296@malibu.cc.uga.edu>
Content-Type: text/plain; charset="us-ascii"

Hi qiantobe -

You want to sort your data, and then put a counter on it using a datastep. Reset the counter at each by-group.

data a; input ID $3.; cards; 001 001 001 002 002 ; run;

proc sort data=a; by ID; run;

data a; set a; by ID; if first.ID then UNID=0; UNID+1; run;

Paul Choate DDS Data Extraction (916) 654-2160

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of SUBSCRIBE SAS-L Anonymous Sent: Wednesday, August 06, 2008 1:04 PM To: SAS-L@LISTSERV.UGA.EDU Subject: order/count question

Hi , I will be appreciated if you can give me some idea: How to create new variable UNID which order the records by each ID? ID UNID 001 1 001 2 001 3 002 1 002 2

Thanks.


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