05-21-2015 10:16 AM
Look at using a DATA step to INPUT your data-records, then test using one of the appropriate ANY-prefix SAS functions found in the SAS Language Elements / CALL function documentation. A tip is that you can use _INFILE_ as the argument passed to your function call, although it is unclear if you want to create an output file (non-SAS) or a SAS data library member based on your input -- that would determine whether or not a FILE statement is warranted as opposed to a SAS member on your DATA statement, instead of DATA _NULL_;
05-21-2015 11:00 AM
My real data looks like,
In this case how to dealt with compress function? Any other functions to look for?
05-21-2015 11:07 AM
if length(strip(compress(the_string,,'d'))) = 0 then output;
I.e. if I remove all numbers, and length is zero, there is nothing other than numbers.
05-21-2015 11:13 AM
That's a good approach, but it needs a little tweaking on two counts. First, STRIP isn't needed. Leading and trailing blanks don't need to be removed if you only want to detect whether any characters remain. Second, LENGTH has a quirk: it never returns zero. The minimum value returned is 1. The easiest way to overcome this is to switch to LENGTHN:
if lengthn(compress(the_string,,'d'))=0 then output;