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 2001, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 8 Jun 2001 10:36:18 -0700
Reply-To:     "Huang, Ya" <ya.huang@AGOURON.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Huang, Ya" <ya.huang@AGOURON.COM>
Subject:      Re: SQL for pedigree numbering?
Comments: To: Philip Whittall <philip.whittall@UNILEVER.COM>
Content-Type: multipart/alternative;

Philip,

I like your code, very slick! But I don't think we have to use character id. As we know, cntlin data can be used to created either format or informat, therefore, just a little bit change (type='C' to type='I', put() to input()) to your code, we can get numeric id:

data a; length id $ 6 animal sire dam $ 8; input animal sire dam; id=_n_; datalines; jan xx xx eileen xx xx kees xx xx doreen xx xx charles jan eileen mary jan eileen andy charles doreen ; data cntlin; set a(rename=(animal=start id=label)); retain fmtname 'ANIMAL' type 'I'; end=start; keep fmtname type start end label; run;

proc format cntlin=cntlin; run; data b; set a; sire_id=input(sire, ?? animal.); dam_id=input(dam, ?? animal.); run;

options missing='0'; proc print; run;

Best regards,

Ya Huang

> -----Original Message----- > From: Philip Whittall [mailto:philip.whittall@UNILEVER.COM] > Sent: Friday, June 08, 2001 9:41 AM > To: SAS-L@LISTSERV.UGA.EDU > Subject: Re: SQL for pedigree numbering? > > > If you don't mind using a character variable > as an id then you can use the format and the > put function directly to generate the id. > > data a; > length id $ 6 animal sire dam $ 8; > input animal sire dam; > id=put(_n_,z6.); > lines; > jan xx xx > eileen xx xx > kees xx xx > doreen xx xx > charles jan eileen > mary jan eileen > andy charles doreen > ; > data cntlin; > set a(rename=(animal=start id=label)); > retain fmtname 'ANIMAL' type 'C'; > end=start; > keep fmtname type start end label; > run; > proc format cntlin=cntlin; > run; > data b; > set a; > sire_id=put(sire,animal.); > dam_id=put(dam,animal.); > run; > proc print; > run; >


[text/html]


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