Macro XSET (from Fraktal SAS Programming): Unterschied zwischen den Versionen

Aus phenixxenia.org
Zur Navigation springen Zur Suche springen
K
K
Zeile 8: Zeile 8:
 
|vorwärts=Macro XDIR (from Fraktal SAS Programming)
 
|vorwärts=Macro XDIR (from Fraktal SAS Programming)
 
}}
 
}}
 +
 +
;This Macro transfers the environment from the particular operating system to SAS Macro variables.
 +
:Characters ''"not appreciated"'' by '''''SAS''''' are removed from variable values.
 +
:If a specific variable name is supplied, this will be the only one tranferred.
  
 
{| class="wikitable"
 
{| class="wikitable"
Zeile 35: Zeile 39:
 
|
 
|
 
:input xvar $ xval $;
 
:input xvar $ xval $;
|Define structure od data stream ''path'' with variables xvar and xval
+
|Define structure of data stream ''path'' with variables xvar and xval
 
|-
 
|-
 
|
 
|

Version vom 4. August 2014, 13:05 Uhr

Zurück

Übersicht

Vorwärts

This Macro transfers the environment from the particular operating system to SAS Macro variables.
Characters "not appreciated" by SAS are removed from variable values.
If a specific variable name is supplied, this will be the only one tranferred.
Code executed Function performed
%MACRO xset(xvar);
Start Macro definition with name and positional parameter xvar
filename path pipe "set" lrecl = 2048;
Open source for text data of type pipe pointing to OS command
data _NULL_;
Start datastep run group
length xvar $256 xval $1024;
Declare variables xvar and xval by length in bytes
infile path dlm = '=';
Utilize data stream from data source path
input xvar $ xval $;
Define structure of data stream path with variables xvar and xval
xvar = upcase(translate(xvar,'_','(-)'));
Remove unwanted characters from variable xvar
%IF %LENGTH(&XVAR.) != 0 %THEN %DO;
Specify condition on macro parameter xvar for using code segment
if trim(xvar) = "%UPCASE(&XVAR.)";
Conditionally executed code
%END;
End condition on macro parameter xvar
call symput(compress(xvar),compress(xval));
Transfer variable values to symbol table
run;
End data step run group
filename path clear;
Close source for text data
%MEND xset;
End Macro definition with name

Zurück

Übersicht

Vorwärts