BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
m_pope
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

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

2 REPLIES 2

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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