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 (February 2005, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 16 Feb 2005 11:25:10 -0800
Reply-To:   "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "Choate, Paul@DDS" <pchoate@DDS.CA.GOV>
Subject:   Re: Conditional statement based on values numeric or character
Comments:   To: Joan A <joanab1970@YAHOO.COM>

Hi Joan - Are you in SASv9?

DATA testd.Target; SET test; length GROUPING $ 30; IF ANYALPHA(substr(NAME,1,1)) THEN GROUPING ='Vendor'; else IF ANYDIGIT(substr(NAME,1,1)) THEN GROUPING ='Supplier'; RUN;

Otherwise you can get get SAS to give you parts of the ascii sequence with the "stringvar=Collate(0,255);" function. Look at the sequence at http://www.lookuptables.com/

hth

Paul Choate DDS Data Extraction (916) 654-2160

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Joan A Sent: Wednesday, February 16, 2005 10:49 AM To: SAS-L@LISTSERV.UGA.EDU Subject: Conditional statement based on values numeric or character

Hello,

I would be very grateful for assistance with the following tasks.

I created a new column called GROUPING that should be populated as Vendor if the first digit in the code is alpha. If the first digit is a number, then it is a Supplier. See code below.

Thank you very much!! Joan

DATA testd.Target; SET test; length GROUPING $ 30; IF substr(CODE,1,1) = <<a letter A_Z >> THEN GROUPING ='Vendor'; IF substr(CODE,1,1) = <<a number 1-9 >> THEN GROUPING ='Supplier'; RUN; QUIT;

--------------------------------- Do you Yahoo!? Yahoo! Search presents - Jib Jab's 'Second Term'


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