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 (May 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 1 May 2002 11:59:19 -0400
Reply-To:   Roger Lustig <rlustig@CBDCREDIT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Roger Lustig <rlustig@CBDCREDIT.COM>
Organization:   Creative Business Decisions, Inc.
Subject:   Re: [DATA STEP]
Content-Type:   text/plain; charset=us-ascii; format=flowed

Zubrowka:

The key is BY processing, with first.col.

data new; set old;

by col notsorted; *<---Just looks for groups;

if first.col then counter + 1; *<--increment when you reach a new group;

length colid $16; *<--Whatever is appropriate;

colid=trim(col)||'_'||left(put(counter,12.)); *<--- I used a wide format just in case you have lots of data! ; run;

Enjoy!

Roger

zubrowka wrote:

> Hi all, > > here is my small problem. > I have a table like that. > > obs col > 1 one > 2 one > 3 one > 4 two > 5 two > 6 two > 7 one > 8 one > 9 three > 10 three > > I want to obtain this > > > obs col colid > 1 one one_1 > 2 one one_1 > 3 one one _1 > 4 two two_2 > 5 two two_2 > 6 two two_2 > 7 one one_3 > 8 one one_3 > 9 three three_4 > 10 three three_4 > etc > > Obviously i cant do a proc sort by col because i will loose the order > of data, which is important. I didn't manage to find a solution. How > can i solve that. > > Thanxs in advance for replying. > > > Zubrowka > >


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