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 (November 2001, week 4)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 28 Nov 2001 08:15:10 -0800
Reply-To:     Jie Qin <c674010@YAHOO.COM>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Jie Qin <c674010@YAHOO.COM>
Subject:      Name Clean Problem has been solved. Thanks. everybody
Comments: To: sas group <sas-l@uga.cc.uga.edu>
Content-Type: text/plain; charset=us-ascii

Here is my code:

data data_clean; set my_sas_dataset;

length b14 b23 $2. b1-b3 b9 b15-b17 b24 $3. b4-b7 b10-b11 b13 b18-b20 b22 b25-b28 b30-b32 $4. b8 b12 b21 b29 b33 $5.; array b{33} $ (' I,' ',I,' ',I ' ', I ' ' II,' ',II,' ',II ' ', II ' 'III' ' IV,' ',IV,' ', IV ' ',IV ' '1V' ' V,' ',V,' ',V ' ', V ' ' VI,' ',VI,' ', VI ' ',VI ' 'V1' 'VII' 'VIII' ' SR,' ',SR,' ',SR ' ', SR ' ' JR,' ',JR,' ',JR ' ', JR ' );

do i=1 to 33; index=index(upcase(nbme_name),b{i}); if index then suffix=compress(b{i},', '); output; end; drop i b1-b33; run;

Jeff and Jonathan correctly identified the problem was due to the leading blank which make index function hard to compare them. They suggested to use trim() function. But my data was pretty nasty. I did need one leading blank for some variables. For example, "Sachi, John" will be wrongly assigned a suffix name "I" if the leading blank of " I," had been removed. The tip of Charles was great. It gave me an idea to develop the rest of this tasks. Thank you so much.

__________________________________________________ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1


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