com.stata.sfi
Class Macro

java.lang.Object
  extended by com.stata.sfi.Macro

public final class Macro
extends Object

Routines for interacting with a Stata macro.


Method Summary
static String getGlobal(String name)
          Get the contents of a global macro.
static String getGlobalSafe(String name)
          Get the contents of a global macro without returning null.
static String getLocal(String name)
          Get the contents of a local macro.
static String getLocalSafe(String name)
          Get the contents of a local macro without returning null.
static int setGlobal(String name, String value)
          Set the value of a global macro.
static int setLocal(String name, String value)
          Set the value of a local macro.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLocal

public static String getLocal(String name)
Get the contents of a local macro.

Parameters:
name - Name of the macro.
Returns:
Value of the macro. Returns null if the macro is not found.

getLocalSafe

public static String getLocalSafe(String name)
Get the contents of a local macro without returning null.

Parameters:
name - Name of the macro.
Returns:
Value of the macro. Returns an empty string if the macro is not found.

getGlobal

public static String getGlobal(String name)
Get the contents of a global macro.

Parameters:
name - Name of the macro.
Returns:
Value of the macro. Returns null if the macro is not found.

getGlobalSafe

public static String getGlobalSafe(String name)
Get the contents of a global macro without returning null.

Parameters:
name - Name of the macro.
Returns:
Value of the macro. Returns an empty string if the macro is not found.

setLocal

public static int setLocal(String name,
                           String value)
Set the value of a local macro. If necessary the macro will be created.

Parameters:
name - Name of the macro.
value - Value to store in the macro.
Returns:
Return code from Stata; 0 if successful.

setGlobal

public static int setGlobal(String name,
                            String value)
Set the value of a global macro. If necessary the macro will be created.

Parameters:
name - Name of the macro.
value - Value to store in the macro.
Returns:
Return code from Stata; 0 if successful.