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

I need to query a name variable and the user wants to know if the name is only a single word.  The variable contains business names so should have multiple words. How do I do that.. for the specific words I am using index(lowercase(name), "Corp")>0 but I do not know how to query for a singer word, no matter what it is.  The name field is Char 26.

 

Any assistance you can offer will be greatly appreciated.

 

Thanks,

Elliott

1 ACCEPTED SOLUTION

Accepted Solutions
Haris
Lapis Lazuli | Level 10
COUNTW counts words, not characters. CountW(VarName)=1 sounds like the condition you're looking for.

View solution in original post

4 REPLIES 4
Haris
Lapis Lazuli | Level 10
Are you looking for COUNTW function?
Elliott
Obsidian | Level 7

no, I need to identify if the business name is only a single word, no matter how many characters.  The user feels this may be an invalid name and wants to review the information.  They feel a single name with no spaces is an invalid business name and should be flagged.

 

Thanks, 

Haris
Lapis Lazuli | Level 10
COUNTW counts words, not characters. CountW(VarName)=1 sounds like the condition you're looking for.
Reeza
Super User

COUNTW() is correct, please try it and let us know. If it's not, post the code you've tried and show an example of a case it doesn't find.

 


@Elliott wrote:

no, I need to identify if the business name is only a single word, no matter how many characters.  The user feels this may be an invalid name and wants to review the information.  They feel a single name with no spaces is an invalid business name and should be flagged.

 

Thanks, 


 

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 663 views
  • 0 likes
  • 3 in conversation