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

Aus phenixxenia.org
Zur Navigation springen Zur Suche springen
(Die Seite wurde neu angelegt: „Kategorie:Zazy {{SeitenNavigation1 |hoch=Duck_zazy_com.png |links=xx_left.png |rechts=xx_right.png |übersicht=Macro Programming (from Fraktal SAS Programm…“)
 
K
 
(13 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 1: Zeile 1:
 
[[Kategorie:Zazy]]
 
[[Kategorie:Zazy]]
 
{{SeitenNavigation1
 
{{SeitenNavigation1
|hoch=Duck_zazy_com.png
+
|hoch=call a macro bubble 0.png
 
|links=xx_left.png
 
|links=xx_left.png
 
|rechts=xx_right.png
 
|rechts=xx_right.png
 
|übersicht=Macro Programming (from Fraktal SAS Programming)
 
|übersicht=Macro Programming (from Fraktal SAS Programming)
|zurück=Macro EDITX (from Fraktal SAS Programming)
+
|zurück=Macro XDIR (from Fraktal SAS Programming)
|vorwärts=Macro EDITX (from Fraktal SAS Programming)
+
|vorwärts=Macro XAMINE (from Fraktal SAS Programming)
 
}}
 
}}
  
%MACRO editx(entry,path);
+
== What it does ==
options nonotes nosource;
+
 
%IF &PATH. eq %THEN %LET path = C:\users\&SYSUSERID.;
+
'''This SAS Macro opens a Program Editor Window in the ''SAS Display Manager'' and loads the file specified by parameters ''xpath'' and ''xentry''.'''
filename path "&PATH";
+
* When ''xpath'' is not supplied, the macro ''XSET'' is called to get the user's home directory and then uses this path.
DM "PGM";
+
* When ''xentry'' is not given, the macro calls ''XDIR'' to list the directory content in the LOG screen.
DM "inc path(&ENTRY.)";
+
 
options notes source;
+
== Annotated Code ==
%MEND editx;
+
 
 +
{| class="wikitable"
 +
! Code executed
 +
! Function performed
 +
|-
 +
|
 +
<font face="Courier New">
 +
;%MACRO xedit(xentry,xpath);
 +
</font>
 +
|Start macro definition with name and positional parameters ''xentry'' and ''xpath''.
 +
|-
 +
|
 +
<font face="Courier New">
 +
:%LOCAL xpath;
 +
</font>
 +
|Declare scope for ''xpath'' to be local.
 +
|-
 +
|
 +
<font face="Courier New">
 +
;%IF %LENGTH(&XPATH.) = 0 %THEN %DO;
 +
</font>
 +
|Start branch for condition "''xpath'' not specified".
 +
|-
 +
|
 +
<font face="Courier New">
 +
:%XSET(homeshare);
 +
</font>
 +
|Call macro ''XSET'' to obtain user's home directory.
 +
|-
 +
|
 +
<font face="Courier New">
 +
:%LET xpath = &HOMESHARE.;
 +
</font>
 +
|Populate ''xpath'' with content from ''homeshare''.
 +
|-
 +
|
 +
<font face="Courier New">
 +
;%END;
 +
</font>
 +
|End branch for condition "''xpath'' not specified".
 +
|-
 +
|
 +
<font face="Courier New">
 +
;filename path "&XPATH";
 +
</font>
 +
|Create file reference using ''xpath''.
 +
|-
 +
|
 +
<font face="Courier New">
 +
;%IF %LENGTH(&XENTRY.) != 0 %THEN %DO;
 +
</font>
 +
|Start branch for condition "''xentry'' is not empty".
 +
|-
 +
|
 +
<font face="Courier New">
 +
:DM "PGM";
 +
</font>
 +
|Open Program Editor window in '''''SAS''''' display manager.
 +
|-
 +
|
 +
<font face="Courier New">
 +
:DM "inc path(&XENTRY.)";
 +
</font>
 +
|Load text file specified by ''xentry'' from directory specified by ''xpath''.
 +
|-
 +
|
 +
<font face="Courier New">
 +
;%END;
 +
</font>
 +
|End branch for condition "''xentry'' is not empty".
 +
|-
 +
|
 +
<font face="Courier New">
 +
;%ELSE %DO;
 +
</font>
 +
|Start branch for condition "''xentry'' is empty".
 +
|-
 +
|
 +
<font face="Courier New">
 +
:%XDIR(&HOMESHARE.);
 +
</font>
 +
|Call macro ''XDIR'' to show content in user's home directory.
 +
|-
 +
|
 +
<font face="Courier New">
 +
;%END;
 +
</font>
 +
|End branch for condition "''xentry'' is empty".
 +
|-
 +
|
 +
<font face="Courier New">
 +
;filename path clear;
 +
</font>
 +
|Clear fileref pointing to ''xpath''.
 +
|-
 +
|
 +
<font face="Courier New">
 +
;%MEND xedit;
 +
</font>
 +
|Finalize macro definition with name.
 +
|}
  
 
{{SeitenNavigation1
 
{{SeitenNavigation1
|hoch=Duck_zazy_com.png
+
|hoch=call a macro bubble 0.png
 
|links=xx_left.png
 
|links=xx_left.png
 
|rechts=xx_right.png
 
|rechts=xx_right.png
 
|übersicht=Macro Programming (from Fraktal SAS Programming)
 
|übersicht=Macro Programming (from Fraktal SAS Programming)
|zurück=Macro EDITX (from Fraktal SAS Programming)
+
|zurück=Macro XDIR (from Fraktal SAS Programming)
|vorwärts=Macro EDITX (from Fraktal SAS Programming)
+
|vorwärts=Macro XAMINE (from Fraktal SAS Programming)
 
}}
 
}}

Aktuelle Version vom 6. Januar 2016, 18:39 Uhr

Zurück

Übersicht

Vorwärts

What it does

This SAS Macro opens a Program Editor Window in the SAS Display Manager and loads the file specified by parameters xpath and xentry.

  • When xpath is not supplied, the macro XSET is called to get the user's home directory and then uses this path.
  • When xentry is not given, the macro calls XDIR to list the directory content in the LOG screen.

Annotated Code

Code executed Function performed

%MACRO xedit(xentry,xpath);

Start macro definition with name and positional parameters xentry and xpath.

%LOCAL xpath;

Declare scope for xpath to be local.

%IF %LENGTH(&XPATH.) = 0 %THEN %DO;

Start branch for condition "xpath not specified".

%XSET(homeshare);

Call macro XSET to obtain user's home directory.

%LET xpath = &HOMESHARE.;

Populate xpath with content from homeshare.

%END;

End branch for condition "xpath not specified".

filename path "&XPATH";

Create file reference using xpath.

%IF %LENGTH(&XENTRY.) != 0 %THEN %DO;

Start branch for condition "xentry is not empty".

DM "PGM";

Open Program Editor window in SAS display manager.

DM "inc path(&XENTRY.)";

Load text file specified by xentry from directory specified by xpath.

%END;

End branch for condition "xentry is not empty".

%ELSE %DO;

Start branch for condition "xentry is empty".

%XDIR(&HOMESHARE.);

Call macro XDIR to show content in user's home directory.

%END;

End branch for condition "xentry is empty".

filename path clear;

Clear fileref pointing to xpath.

%MEND xedit;

Finalize macro definition with name.

Zurück

Übersicht

Vorwärts