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