Help using Base SAS procedures

how to best verify if a field contains the good characters?

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

how to best verify if a field contains the good characters?

Hi guys,

I am trying to check if a specific field contains only text characters.

I am using the following code to verify if the field country does not contain any numeric char:

verify(country,"ABCDEFGHIJKLM")>0

I wonder if there are better ways to achieve that objective.

Thanks for all your help in advance!

Cheers,

Tom


Accepted Solutions
Solution
‎02-14-2012 01:35 PM
PROC Star
Posts: 7,356

how to best verify if a field contains the good characters?

You could use the notalpha function http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002194058.htm

If it returns a non-zero value the field contains something other than alpha characters

View solution in original post


All Replies
Solution
‎02-14-2012 01:35 PM
PROC Star
Posts: 7,356

how to best verify if a field contains the good characters?

You could use the notalpha function http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a002194058.htm

If it returns a non-zero value the field contains something other than alpha characters

Respected Advisor
Posts: 3,124

how to best verify if a field contains the good characters?

Add a few,

And of course compress() plus lengthn().

Regards,

Haikuo

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 108 views
  • 3 likes
  • 3 in conversation