hi there,
I need identify if there is random non-numeric (may incl. Alphabet, symbols, etc.) value in a variable which is a text string.
is there a better way to do it?
data _null_;
set test;
j=0;
do until(j=0);
j=notdigit(Var,j+1);
if j=0 then put +3 "That's all";
else do;
c=substr(Var,j,1);
put +3 j= c=;
end;
end;
run;
I don't think the looping is needed.
All you need is
if notdigit(var)>0 then ... ;
I don't think the looping is needed.
All you need is
if notdigit(var)>0 then ... ;
Hi Paige,
Thanks for your answer. I have tested and it worked 🙂 just not sure if it would pick up all the ones with random combination of symbols.
But it worked for my data.
Cheers
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.