|
"Joan A" <joanab1970@YAHOO.COM> wrote in message
news:20050216184857.65585.qmail@web31009.mail.mud.yahoo.com...
> 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;
There are several different solutions ...
ex.
IF upcase(substr(CODE,1,1)) in('A','B','C' .........) then GROUPING
='Vendor';
else grouping ='Supplier' ;
could be "reversed" like this
IF input(substr(CODE,1,1)),1.) ne . then grouping = 'Suppiler';
else grouping='Vendor';
other options could be using either INDEX or INDEXC (both functions)
Jan
|