Hi All,
I have created one SAS job with below mentioned user written code which is failing with error due to it is not assigning correct variable value.
%include '/sascon/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/custom/config/autoexec.sas';
%macro aml_dwjn_monthly;
%local dwjn_file;
%let dwjn_file=/sascon/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/watchlist/CSV_PFA_201808042200_D.csv;
%put &dwjn_file;
%include '/sascon/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/custom/source/aml_load_watch_list_dwjn_monthly.sas';
%aml_load_watch_list_dwjn_monthly (dwjn_file=&dwjn_file);
%mend aml_dwjn_monthly;
%aml_dwjn_monthly;
User Written Line 4,992: WARNING: The text expression &DWJN_FILE contains a recursive reference to the macro variable DWJN_FILE. The macro variable will be assigned the null value.
Line 4,992: ERROR: Invalid physical name. Line 4,992: ERROR: Error in the FILENAME statement.
Can some body help me why this macro variable is assigning to null value but it is giving expected result in %PUT statement.
How i can resolve this error ?
The message means that somewhere, the code generates the equivalent of:
%let DWJN_FILE= ... &DWJN_FILE ... ;
which is a recursive reference.
@ChrisNZ What is the solution for this ?
That's a bug in the code. The code must be fixed.
Try to find the filename statement that seems to cause the issue.
Hi @MG18
You are using the following code lines (Partial extract)
%local dwjn_file;
%let dwjn_file=/sascon/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/watchlist/CSV_PFA_201808042200_D.csv;
%put &dwjn_file;
%include '/sascon/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/custom/source/aml_load_watch_list_dwjn_monthly.sas';
%aml_load_watch_list_dwjn_monthly (dwjn_file=&dwjn_file);
*
%aml_load_watch_list_dwjn_monthly (dwjn_file=&dwjn_file); /* This is the offending line! */
I would suggest the following miner change, to clarify your code and avoid the error you are getting now
%include '/sascon/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/custom/config/autoexec.sas';
%macro aml_dwjn_monthly;
%local l_dwjn_file; /* Added 'l_' prefix to indicate local scope */
%let l_dwjn_file=/sascon/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/watchlist/CSV_PFA_201808042200_D.csv;
%put &l_dwjn_file;
%include '/sascon/Lev1/Applications/SASAntiMoneyLaundering/5.1/BUJO/custom/source/aml_load_watch_list_dwjn_monthly.sas';
%aml_load_watch_list_dwjn_monthly (dwjn_file=&l_dwjn_file);
%mend aml_dwjn_monthly;
%aml_dwjn_monthly;
Hope this helps,
Ahmed
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.