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!
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.
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.