|
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'
|