BookmarkSubscribeRSS Feed
rohithverma
Obsidian | Level 7

%macro utr(i,bnk_inp);

/****************Cond2*************************/
 %if &UTRNAM =0 and &bennam > 0 %then %do;

DATA rr.UTR_&i(drop=BENE_ACK rename=(BENE_ACK_=BENE_ACK));
SET rr.utr_&i;
%if %substr(BENE_ACK,1,2)="00" %then BENE_ACK_=%substr(BENE_ACK,3);
%else BENE_ACK_=BENE_ACK;
run;

proc sql;
create table rr.first_&i as
select *,(a.narration=b."MBOL REFERENCE NO"n) as indic ,
(a.narration ~= "")as step1,
(b."MBOL REFERENCE NO"n ne "") as utr,
coalesce( a.narration ,b."MBOL REFERENCE NO"n) as fid
from rr.&bnk_inp a full join rr.UTR_&i b on compress(a.narration)=compress(b."MBOL REFERENCE NO"n);
quit;

data rr.ref_match_&i;
set rr.first_&i;
where ((indic =1 and step1=1 ) or ( indic=1 and step1=0 and utr=0 and fid= " "));
run;

proc sql;
create table rr.narration_ref_mismatch_&i as
select * from rr.&bnk_inp where compress(narration) not in ( select narration from rr.ref_match_&i );
quit;

proc sql;
create table rr.sec_c2_&i as
select *,(a.narration=b.bene_ack) as indic ,
(a.narration ne "")as step1,
(b.bene_ack ne "") as utr,
coalesce( a.narration ,b.bene_ack) as fid
from rr.narration_ref_mismatch_&i a full join rr.utr_&i b on a.narration=b.bene_ack;
quit;

data rr.ben_match_&i;
set rr.sec_c2_&i;
where (indic =1 and step1=1);
run;

proc sql;
create table rr.overall_mismatch_&i as
select *,"mismatch" as flag from rr.narration_ref_mismatch_&i where compress(narration) not in ( select narration from rr.ben_match_&i );
quit;
%end;
%mend;

%macro uu;
%IF IF &II > 0 AND &FF > 0 %THEN %UTR(1,step1_) and %UTR(2,overall_mismatch_1);
%mend;
%uu;

 

Here i am trying to invoke a same macro twice .But i am facing the following error in the log

 


180: LINE and COLUMN cannot be determined.
NOTE: NOSPOOL is on. Rerunning with OPTION SPOOL might allow recovery of the LINE and COLUMN where the error has occurred.
ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE: Line generated by the invoked macro "UTR".
88 DATA rr.UTR_&i(drop=BENE_ACK rename=(BENE_ACK_=BENE_ACK)); SET rr.utr_&i;
___
180
ERROR 180-322: Statement is not valid or it is used out of proper order.


NOTE: Line generated by the invoked macro "UTR".
88 BENE_ACK_=BENE_ACK
_________
180

ERROR 180-322: Statement is not valid or it is used out of proper order.

NOTE: Table RR.FIRST_2 created, with 115063 rows and 74 columns.

2 REPLIES 2
PaigeMiller
Diamond | Level 26

When you post a log here, it is important to click on the {i} icon and then paste the log into the window that appears. This preserves the formatting of the log, so that it appears here in the SAS Communities exactly as you see it in SAS. and makes it easier to understand. Please provide the log in that format.

--
Paige Miller
Cynthia_sas
Diamond | Level 26

Hi:

  This same question has been posted in the SAS Programming forum, where it is more appropriate, since Macro programming is not really a new user topic. There are already answers and suggestions posted in the other forum, so instead of adding to this post, please respond or review in THIS posting: https://communities.sas.com/t5/SAS-Programming/calling-macro/m-p/628403

 

Thanks,

Cynthia

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

Register now

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
  • 2 replies
  • 1059 views
  • 0 likes
  • 3 in conversation