DATA Step, Macro, Functions and more

EnterpriseGuide(Windows) and AIX environment execute macro I/O functions differently. WARNING: Argument 1 to function ATTRN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

EnterpriseGuide(Windows) and AIX environment execute macro I/O functions differently. WARNING: Argument 1 to function ATTRN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.

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


Accepted Solutions
Solution
‎09-10-2013 09:36 AM
Respected Advisor
Posts: 3,777

Re: EnterpriseGuide(Windows) and AIX environment execute macro I/O functions differently. WARNING: Argument 1 to function ATTRN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.

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,'))'));

View solution in original post


All Replies
Solution
‎09-10-2013 09:36 AM
Respected Advisor
Posts: 3,777

Re: EnterpriseGuide(Windows) and AIX environment execute macro I/O functions differently. WARNING: Argument 1 to function ATTRN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.

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,'))'));

New Contributor
Posts: 2

Re: EnterpriseGuide(Windows) and AIX environment execute macro I/O functions differently. WARNING: Argument 1 to function ATTRN referenced by the %SYSFUNC or %QSYSFUNC macro function is out of range.

Works perfectly, thanks very much!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 421 views
  • 1 like
  • 2 in conversation