Fully Qualified Coding (from Fraktal SAS Programming): Unterschied zwischen den Versionen

Aus phenixxenia.org
Zur Navigation springen Zur Suche springen
K
K
 
Zeile 22: Zeile 22:
 
  %IF <condition> %THEN %DO;
 
  %IF <condition> %THEN %DO;
 
  <program code>
 
  <program code>
  %END
+
  %END;
 
  %ELSE %DO;
 
  %ELSE %DO;
 
  <alternate program code>
 
  <alternate program code>
  %END
+
  %END;
 
  /*
 
  /*
 
  [[Process Metadata (from Fraktal SAS Programming)|program code controlled by dynamic metadata]]
 
  [[Process Metadata (from Fraktal SAS Programming)|program code controlled by dynamic metadata]]
 +
*/
 
  <obtain metadata>
 
  <obtain metadata>
 
  <count list elements>
 
  <count list elements>
 
  <utilize metadata>
 
  <utilize metadata>
*/
 
 
  /*
 
  /*
 
  [[Realtime Information (from Fraktal SAS Programming)|send mail for realtime information]]
 
  [[Realtime Information (from Fraktal SAS Programming)|send mail for realtime information]]
Zeile 41: Zeile 41:
 
At time of invocation, precautions will be made to trigger and [[Stored Workflow Documentation (from Fraktal SAS Programming)|store]] [[Workflow Documentation (from Fraktal SAS Programming)|workflow documentation]]:
 
At time of invocation, precautions will be made to trigger and [[Stored Workflow Documentation (from Fraktal SAS Programming)|store]] [[Workflow Documentation (from Fraktal SAS Programming)|workflow documentation]]:
  
/*
 
Invocation
 
*/
 
 
  proc printto LOG = "C:\TEMP\MyLOG.txt";  
 
  proc printto LOG = "C:\TEMP\MyLOG.txt";  
 
  systask command "del C:\TEMP\MyCODE.sas" wait;
 
  systask command "del C:\TEMP\MyCODE.sas" wait;
 
  filename mprint "C:\TEMP\MyCODE.sas";
 
  filename mprint "C:\TEMP\MyCODE.sas";
 
  options mprint mfile;
 
  options mprint mfile;
 +
 
  %NAME;
 
  %NAME;
 +
 
  options nomprint nomfile;
 
  options nomprint nomfile;
 
  filename mprint clear;
 
  filename mprint clear;

Aktuelle Version vom 15. Mai 2014, 20:05 Uhr

Zurück

Übersicht

Vorwärts

With all forementioned aspects in mind and applied, our SAS macro will now look very much different from the original MACRO definition in "Straightforward Coding". The definition structure will be slightly more complex:

%MACRO name;
/*
declare parameter scope
*/
%LOCAL <parameters of local scope>;
%GLOBAL <parameters of global scope>;
/*
apply static logic for branching
*/
%IF <condition> %THEN %DO;
<program code>
%END;
%ELSE %DO;
<alternate program code>
%END;
/*
program code controlled by dynamic metadata
*/
<obtain metadata>
<count list elements>
<utilize metadata>
/*
send mail for realtime information
*/
<create fileref with mail tags and define attachements>
<use fileref to edit mail body and trigger mail submission>
%MEND name;

At time of invocation, precautions will be made to trigger and store workflow documentation:

proc printto LOG = "C:\TEMP\MyLOG.txt"; 
systask command "del C:\TEMP\MyCODE.sas" wait;
filename mprint "C:\TEMP\MyCODE.sas";
options mprint mfile;
%NAME;
options nomprint nomfile;
filename mprint clear;
proc printto LOG = LOG; 

Zurück

Übersicht

Vorwärts