Hello fellow programmers,
I have the problem that SAS I/O functions executed in macros work flawlessly in EnterpriseGuide (Windows Client) but if run on an the SAS AIX server they generate the following Code:
WARNING: Argument 1 to function ATTRN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.
NOTE: Mathematical operations could not be performed during %SYSFUNC function execution. The result of the operations have been set to a missing value.
Here the rough code as follows:
%macro subchar_kurz_ausgabe(vert,dat,da);
proc sql;
create table ausg_paxzahlen_&vert._&dat.(drop=andatx vertragspartner code code_depa code_dest hr_kenz) as
select
[...]
from ausg_paxzahlen_&vert._&dat._verd
[...]
quit;
%let datset = ausg_paxzahlen_&vert._&dat;
%let dsid = %sysfunc(open(&datset));
%let anzobs = %sysfunc(attrn(&dsid,nobs));
%let dsid = %sysfunc(close(&dsid));
%put &anzobs;
%if &anzobs gt 0 %then %do;
ods csvall file="/nfs/nfsserver/islisten/OPS/paxneu/&dateidat._&vert._&da._m.csv" options(delimiter=';');
proc print data=ausg_paxzahlen_&vert._&dat label noobs; run;
ods csvall close;
%end;
%mend subchar_kurz_ausgabe;
data _null_;
set subsent;
format abda $10.;
do abdat = &dat_von to &dat_bis;
abda = put(abdat,yymmddp10.);
call execute(cats('%subchar_kurz_ausgabe(',vp_kuerzel,',',abdat,',',abda,')'));
end;
run;
The aim of this construct ist to only generate csv files if there is any data available.
As describes initially, this code works wonderfully in the EG (5.1, SAS Version 9.3) . On AIX DSID resolves to 0 and ANZOBS zo missing.
Thanks in advance for some enlightement.
Yours,
Manuel
You need %NRSTR to delay the macro call until after the data step finishes.
call execute(cats('%nrstr(%subchar_kurz_ausgabe(',vp_kuerzel,',',abdat,',',abda,'))'));
You need %NRSTR to delay the macro call until after the data step finishes.
call execute(cats('%nrstr(%subchar_kurz_ausgabe(',vp_kuerzel,',',abdat,',',abda,'))'));
Works perfectly, thanks very much!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.