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 (April 1997, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 30 Apr 1997 17:14:20 -0500
Reply-To:     kalfast <kalfast@PPRD.ABBOTT.COM>
Sender:       "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From:         kalfast <kalfast@PPRD.ABBOTT.COM>
Organization: Abbott Laboratories
Subject:      Re: ***** I need help urgently ******
Comments: To: trogers@patriot.net
Content-Type: text/plain; charset=us-ascii

Tim Rogers wrote: > > I have a data set with 7,033 obs, the following is a sample data set: > > siteid agncyabr > 1646 cd > 1646 fsa > 1646 nrcs > 1972 fsa > 1972 nrcs > 1981 rd > 1981 fsa > 1990 rd > > I want to create a new variable called 'colocate'. If the the agncyabr > has the same siteid as other agncyabr's, then I want the out put dataset > to look like the following. > > siteid agncyabr colocate > 1646 cd cd fsa nrcs > 1646 fsa cd fsa nrcs > 1646 nrcs cd fsa nrcs > 1972 fsa fsa nrcs > 1972 nrcs fsa nrcs > 1981 rd fsa rd > 1981 fsa fsa rd > 1990 rd rd > > I appreciate any help, greatly. > -- > ****************************************************************** > * Tim Rogers V-Mail: 703-689-0595 * > * Associate Consultant Fax: 703-968-0595 * > * Advantage Systems Group Inc. E-Mail: trogers@novarealty.com * > * 1-800-484-5189 code 8077 trogers@patriot.net * > ******************************************************************

Tim,

This should solve your problem:

proc sort data=<lib.>agncyabr out=agncyabr; by siteid agncyabr; run;

data colocate; length colocate $80; by siteid agncyabr; retain colocate; if first.siteid then colocate=agncyabr; else colocate=trim(colocate)||' '||agncyabr; if last.siteid then output; run;

data <lib.><dataset_name>; merge agncyabr colocate; by siteid; run;

HTH,

Tom -- Thomas Kalfas, Consultant Abbott Laboratories

E-mail: kalfast@pprd.abbott.com

Phone: (847) 938-8101 Fax: (847) 938-1736


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