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 2005, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 10 Aug 2005 07:26:12 -0700
Reply-To:     Wendy <XieWeiTing@GMAIL.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Wendy <XieWeiTing@GMAIL.COM>
Organization: http://groups.google.com
Subject:      Re: How to extract the last name,
Comments: To: sas-l@uga.edu
In-Reply-To:  <7d11935705081006585d1445cd@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

data test1; set test; name=trim(left(name)); if index(name,",") ne 0 then do; first =scan(name,3," "",""."); middle=scan(name,2," "",""."); last=scan(name,1," "",""."); if first="" and middle ne "" then do ; first=middle; middle=""; end; end;

else do; first =scan(name,1," ""."); middle=scan(name,2," ""."); last=scan(name,3," ""."); if last="" and middle ne "" then do ; last=middle; middle=""; end; end; run;


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