Package com.stata.sfi

Class Characteristic

java.lang.Object
com.stata.sfi.Characteristic

public class Characteristic extends Object
This class provides access to Stata characteristics.

Examples:

Loading and saving dataset characteristics...

	public static int getDtaChar(String[] args) {
		String charName = args[0];
		String value = Characteristic.getDtaChar(charName);
		SFIToolkit.displayln("dta[" + charName + "]: " + value);
		return 0;
	}

	public static int setDtaChar(String[] args) {
		String charName = args[0];
		String value = args[1];
		int rc = Characteristic.setDtaChar(charName, value);
		return rc;
	}

Loading and saving variable characteristics...

	public static int getVarChar(String[] args) {
		String var = args[0];
		String charName = args[1];
		String value = Characteristic.getVariableChar(var, charName);
		SFIToolkit.displayln(var +"[" + charName + "]: " + value);
		return 0;
	}

	public static int setVarChar(String[] args) {
		String varName = args[0];
		String charName = args[1];
		String value = args[2];
		int rc = Characteristic.setVariableChar(varName, charName, value);
		return rc;
	}

  • Method Details

    • getDtaChar

      @Synchronized public static String getDtaChar(String name)
      Get a characteristic for the current dataset.
      Parameters:
      name - The name of the characteristic to retrieve.
      Returns:
      Value of the characteristic. Returns null if the characteristic is not found.
    • getVariableChar

      @Synchronized public static String getVariableChar(String variable, String name)
      Get a characteristic for a variable in the current dataset.
      Parameters:
      variable - Name of the variable.
      name - Name of the characteristic.
      Returns:
      Value of the characteristic. Returns null if the characteristic is not found.
    • setDtaChar

      @Synchronized public static int setDtaChar(String name, String value)
      Set a characteristic for the current dataset.
      Parameters:
      name - Name of the characteristic.
      value - Value to set.
      Returns:
      Return code from Stata; 0 if successful.
    • setVariableChar

      @Synchronized public static int setVariableChar(String variable, String name, String value)
      Set a characteristic for a variable in the current dataset.
      Parameters:
      variable - Name of the variable.
      name - Name of the characteristic.
      value - Value to set.
      Returns:
      Return code from Stata; 0 if successful.