BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
djbateman
Lapis Lazuli | Level 10

Can someone explain to me why I'm getting the warning that I'm getting?  I've tried reading other posts and can't find a solution.

 

At various times throughout a program, I am passing a parameter that is typically 2-6 characters plus a 3-digit number through a macro.  In the macro, I am trying to extract just the digits.  I'm trying to use the A modifier in the compress() function, but I get a warning that appears twice with every pass of the macro:

 

WARNING: In a call to the COMPRESS function or routine, the modifier "'" not valid.

 

The warning isn't influencing the output (as you can see in the log), but I still want to understand the warning:

 

6968   %macro check (dsin=);
6969       %let checkval=%sysfunc(compress(&dsin.,'','a'));
6970       %put CHECKVAL=~~~&checkval.~~~;
6971   %mend check;
6972
6973
6974   %check (dsin=AE001);
WARNING: In a call to the COMPRESS function or routine, the modifier "'" not valid.
WARNING: In a call to the COMPRESS function or routine, the modifier "'" not valid.
CHECKVAL=~~~001~~~

Here is a very small portion of the macro I am running with various test cases for the input parameter:

 

%macro check (dsin=);
	%let checkval=%sysfunc(compress(&dsin.,'','a'));
	%put CHECKVAL=~~~&checkval.~~~;
%mend check;

%check (dsin=AE001);
%check (dsin=AE002);
%check (dsin=AE003);
%check (dsin=AE004);
%check (dsin=AE005);
%check (dsin=CFAE003);
%check (dsin=AE003);
%check (dsin=AE004);
%check (dsin=AE011);
%check (dsin=BF012);
%check (dsin=ZQ014);
%check (dsin=LKNM016);

 

1 ACCEPTED SOLUTION

Accepted Solutions
novinosrin
Tourmaline | Level 20

This works for me

 

%macro check (dsin=);
	%let checkval=%sysfunc(compress(&dsin,,ai));
	%put CHECKVAL=~~~&checkval.~~~;
%mend check;

%check (dsin=AE001)

I added i modifier to your a to ignore case sensitive operation 

View solution in original post

5 REPLIES 5
novinosrin
Tourmaline | Level 20

syntax check

Try-

6968   %macro check (dsin=);
6969       %let checkval=%sysfunc(compress(&dsin.,  ,a));
6970       %put CHECKVAL=~~~&checkval.~~~;
6971   %mend check;
6972
6973
6974   %check (dsin=AE001);

 

novinosrin
Tourmaline | Level 20

This works for me

 

%macro check (dsin=);
	%let checkval=%sysfunc(compress(&dsin,,ai));
	%put CHECKVAL=~~~&checkval.~~~;
%mend check;

%check (dsin=AE001)

I added i modifier to your a to ignore case sensitive operation 

xinzhou
Calcite | Level 5
This solutions works for me
djbateman
Lapis Lazuli | Level 10

Oh my goodness.  It was just the single quotes around the A modifier?  I was trying so many different things like quotes around the &dsin. parameter or quotes around blank space in the 2nd compress parameter.  Nothing was working, but removing the quotes around the modifier did the trick.  Thanks!

Sukesh33
Calcite | Level 5
@djbateman, Thanks! it helped me resolve the same warning.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 5 replies
  • 4053 views
  • 3 likes
  • 4 in conversation