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

Aus phenixxenia.org
Zur Navigation springen Zur Suche springen
K
K
Zeile 117: Zeile 117:
 
|Finalize macro definition with name.
 
|Finalize macro definition with name.
 
|}
 
|}
 
== Special Effects ==
 
 
# The macro makes use of the 'pipe' type file reference. When used appropriately, this returns a list that is instantly generated by an OS command that is given as the statement's argument.
 
 
# As an alternate text processing instance the macro uses a SYSTASK statement to call the windows component 'Wordpad'. Since each paticular windows installation uses its own path structure, the macro makes use of the 'windir' environment variable.
 
  
 
{{SeitenNavigation1
 
{{SeitenNavigation1

Version vom 29. Januar 2015, 20:56 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