Search code examples
macrossasexecute

SAS include dynamic path


I have tryed build little macro which in loop it should runother SAS programs. Table Control_files has two field, where are other part of path to proper sas program.

%LET PATH_TO = '%include "T:\XXX\YYY\ZZZ\';
%LET PATH_end = '.sas"';
data _null_;
set CONTROL_FILES;
call execute ('%runlimitsquery('||&PATH_TO||SCHEMA_NAME||'\'||PROCES_NAME||&PATH_end||');');
run;

I tryed used runlimitsquery because I found somewhere that tip.. When I run my code, log returns:

NOTE: CALL EXECUTE generated line.
NOTE: Line generated by the CALL EXECUTE routine.
1         + %runlimitsquery(%include "T:\XXX\YYY\ZZZ\XXX_TECHNICAL_AAAAA\001_AAAAA.sas");
            _
            180
WARNING: Apparent invocation of macro RUNLIMITSQUERY not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order

Anyone can help me?


Solution

  • Ok, I have answer for my problem... Below code works:

    %LET PATH_TO = '%include "T:\XXX\YYY\ZZZ\';
    %LET PATH_end = '.sas"';
    data _null_;
    set CONTROL_FILES;
    call execute ('('||&PATH_TO.||SCHEMA_NAME||'\'||PROCES_NAME||&PATH_end.||';');
    run;