BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Suzy_Cat
Pyrite | Level 9

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;

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

I don't think the looping is needed.

 

All you need is

 

if notdigit(var)>0 then ...   ;
--
Paige Miller

View solution in original post

2 REPLIES 2
PaigeMiller
Diamond | Level 26

I don't think the looping is needed.

 

All you need is

 

if notdigit(var)>0 then ...   ;
--
Paige Miller
Suzy_Cat
Pyrite | Level 9

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

 

 

 

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 5778 views
  • 0 likes
  • 2 in conversation