SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pavelr
Obsidian | Level 7

Hello!

KCOMPARE function syntax from SAS documentation:

KCOMPARE(source,<pos, count, > findstr,<modifiers>)

 

Why this code:

data test;
b=kcompare("qwerty",1,6,"QWERTY","i");
run;

causes this error: ERROR 72-185: The KCOMPARE function call has too many arguments?

1 ACCEPTED SOLUTION

Accepted Solutions
pavelr
Obsidian | Level 7

Update: 

it looks like it was fixed in later release of M6 (while I was running in earlier release). And it is fixed in 9.4 M7.

View solution in original post

5 REPLIES 5
Ksharp
Super User
It is just like COMPARE() I guess.

data test;
b=kcompare("qwerty","QWERTY","i");
run;
AMSAS
SAS Super FREQ

I recommend you open a TS track for this question.

Please include the following:

- Title "KCOMPARE returns error "The KCOMPARE function call has too many arguments" when 5 arguments are supplied
- SAS Version you are running (the following code will report SAS version information)
%put &sysvlong ;
%put &sysscpl ;
%put &syssite ;
- Registry Report (*.txt files) for each server, please clearly name the report files to reflect the server it was executed on.

- The code (as you have it here)

- The SAS Log 

 

 

Tom
Super User Tom
Super User

Are you running regular SAS code? Or are you using CAS/Viya?

Are you using DBCS?

Also this page seems to indicate the MODIFIER optional argument is not supported.

DBCS Compatibility

The DBCS equivalent function is KCOMPARE Function in SAS National Language Support (NLS): Reference Guide. There are minor differences between the COMPARE and KCOMPARE functions. Both functions accept varying numbers of arguments. Usage of the third argument is not compatible. This example shows the differences in the syntax.

COMPARE(string-1, string-2 <, modifier(s)>)
KCOMPARE(string-1 <, position <, count> >, string-2)
ChrisNZ
Tourmaline | Level 20

It looks like the documentation is inconsistent.

Click on the feedback button on the documentation page, the team are really good at replying.

pavelr
Obsidian | Level 7

Update: 

it looks like it was fixed in later release of M6 (while I was running in earlier release). And it is fixed in 9.4 M7.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 1414 views
  • 4 likes
  • 5 in conversation