BookmarkSubscribeRSS Feed
TX_STAR
Obsidian | Level 7

Dear all,

I am running the following code but SAS gave the error note:

ERROR 72-185: The ABS function call has too many arguments.


data scfile1_;
set scfile1;
length cut_Label $40 ;
cut_Label=' ';
cut2015_Dif=round(abs(&cut2015.-ScaleS),.001);
cut2016_Dif=round(abs(&cut2016.-ScaleS), .001);
cut2022_Dif=round(abs(&cut2022.-ScaleS), .001);
cutIII_Dif=round(abs(&cutIII.-ScaleS), .001);

run;

 

I ran same code in similar procedures using similar data, there wasn't any problem. I don't know why it happens to this one.

 

Thanks,

ZL

5 REPLIES 5
ballardw
Super User

And what exactly are the values of the &cut2015, &cut2016, &cut2022 and &cutIII  macro variables?

 

Likely that one of those is the culprit but you didn't show the macro value or the actual log.

Best would be to run:

options mprint symbolgen;

<your code>

and post the result from log including the generated macro resolution and the error message into a code box opened here with the forum {I} menu icon.

TX_STAR
Obsidian | Level 7

Hi ballardw,

Thank you for your reply.

Is it because the formats of values that the macro variables resolves to, 2000, 2,500, 3,000, 3,500?

2000 was treated as number as it worked in the this piece of code: cut2015_Dif=round(abs(&cut2015.-ScaleS),.001);

 2,500, 3,000, 3,500 did not work.

 

 

here is the code and log


proc sql noprint;

select cut2015 into :cut2015 from standards;
select cut2016 into :cut2016 from standards;
select cut2022 into :cut2022 from standards;
select cutIII into :cutIII from standards;
quit;
%put ***** cut2015 is:&cut2015.;
%put ***** cut2016 is:&cut2016.;
%put ***** cut2022 is:&cut2022.;
%put ***** cutIII is:&cutIII.;

 

data scfile1_;
set scfile1;
length cut_Label $40 ;
cut_Label='';
cut2015_Dif=round(abs(&cut2015.-ScaleS),.001);
cut2016_Dif=round(abs(&cut2016.-ScaleS), .001);
cut2022_Dif=round(abs(&cut2022.-ScaleS), .001);
cutIII_Dif=round(abs(&cutIII.-ScaleS), .001);

run;

 

 ****log---------------------------------------------------------------;

1393 proc sql noprint;
1394
1395 select cut2015 into :cut2015 from standards;
1396 select cut2016 into :cut2016 from standards;
1397 select cut2022 into :cut2022 from standards;
1398 select cutIII into :cutIII from standards;
1399 quit;
NOTE: PROCEDURE SQL used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds


SYMBOLGEN: Macro variable CUT2015 resolves to 2000
1400 %put ***** cut2015 is:&cut2015.;
***** cut2015 is:2000
1401 %put ***** cut2016 is:&cut2016.;
SYMBOLGEN: Macro variable CUT2016 resolves to 2,500
***** cut2016 is: 2,500
1402 %put ***** cut2022 is:&cut2022.;
SYMBOLGEN: Macro variable CUT2022 resolves to 3,000
***** cut2022 is:3,000
1403 %put ***** cutIII is:&cutIII.;
SYMBOLGEN: Macro variable CUTIII resolves to 3,500
***** cutIII is: 3,500
1404
1405 data scfile1_;
1406 set scfile1;
1407 length cut_Label $40 ;
1408 cut_Label='';
1409 cut2015_Dif=round(abs(&cut2015.-ScaleS),.001);
SYMBOLGEN: Macro variable CUT2015 resolves to 2000
1410 cut2016_Dif=round(abs(&cut2016.-ScaleS), .001);
SYMBOLGEN: Macro variable CUT2016 resolves to 2,500
1410 cut2016_Dif=round(abs(&cut2016.-ScaleS), .001);
---
72
ERROR 72-185: The ABS function call has too many arguments.

1411 cut2022_Dif=round(abs(&cut2022.-ScaleS), .001);
SYMBOLGEN: Macro variable CUT2022 resolves to 3,000
1411 cut2022_Dif=round(abs(&cut2022.-ScaleS), .001);
---
72
ERROR 72-185: The ABS function call has too many arguments.

1412 cutIII_Dif=round(abs(&cutIII.-ScaleS), .001);
SYMBOLGEN: Macro variable CUTIII resolves to 3,500
1412 cutIII_Dif=round(abs(&cutIII.-ScaleS), .001);
---
72
ERROR 72-185: The ABS function call has too many arguments.

1413
1414 run;

NOTE: The SAS System stopped processing this step because of errors.
WARNING: The data set WORK.SCFILE1_ may be incomplete. When this step was stopped there were 0
observations and 12 variables.
WARNING: Data set WORK.SCFILE1_ was not replaced because this step was stopped.
NOTE: DATA statement used (Total process time):
real time 0.02 seconds
cpu time 0.04 seconds

SASKiwi
PROC Star

Remove the commas from your macro variables. SAS is treating these as the boundary for a new argument to the ABS function.

Reeza
Super User

abs(2000) ->This works

abs(2,000) -> this errors with too many arguments. 

 

Difference is the comma -> remove the comma.

 

 

TX_STAR
Obsidian | Level 7

Thank you all. It worked after removing the comma.

🙂 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 5 replies
  • 2692 views
  • 2 likes
  • 4 in conversation