Package com.stata.sfi
Class Scalar
java.lang.Object
com.stata.sfi.Scalar
This class provides access to Stata scalars.
 
Examples:
Loading and saving scalars...
	public static int getStringScalar(String[] args) {
		String name = args[0];
		String contents = Scalar.getString(name);
		SFIToolkit.displayln(name + " = " + contents);
		return 0;
	}
	public static int setStringScalar(String[] args) {
		String name = args[0];
		String contents = args[1];
		int rc = Scalar.setString(name, contents);
		return rc;
	}
	public static int getScalar(String[] args) {
		String name = args[0];
		Double contents = Scalar.getValue(name);
		SFIToolkit.displayln(name + " = " + contents);
		return 0;
	}
	public static int setScalar(String[] args) {
		String name = args[0];
		Double value = Double.parseDouble(args[1]);
		int rc = Scalar.setValue(name, value);
		return rc;
	}
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int
- 
Method SummaryModifier and TypeMethodDescriptionstatic StringGet the contents of a Stata string scalar.static StringGet the contents of a Stata string scalar.static DoubleGet the contents of a Stata scalar.static DoubleGet the contents of a Stata scalar.static intSet the contents of a Stata string scalar.static intSet the contents of a Stata string scalar.static intSet the value of a Stata scalar.static intSet the value of a Stata scalar.static intSet the value of a Stata scalar.static intSet the value of a Stata scalar.
- 
Field Details- 
TYPE_AUTOMATICpublic static final int TYPE_AUTOMATIC- See Also:
 
- 
TYPE_CRETURNpublic static final int TYPE_CRETURN- See Also:
 
- 
TYPE_ERETURNpublic static final int TYPE_ERETURN- See Also:
 
- 
TYPE_GLOBALpublic static final int TYPE_GLOBAL- See Also:
 
- 
TYPE_RETURNpublic static final int TYPE_RETURN- See Also:
 
- 
TYPE_RRETURNpublic static final int TYPE_RRETURN- See Also:
 
- 
TYPE_SRETURNpublic static final int TYPE_SRETURN- See Also:
 
- 
VTYPE_HIDDENpublic static final int VTYPE_HIDDEN- See Also:
 
- 
VTYPE_HISTORICALpublic static final int VTYPE_HISTORICAL- See Also:
 
- 
VTYPE_VISIBLEpublic static final int VTYPE_VISIBLE- See Also:
 
 
- 
- 
Method Details- 
getStringGet the contents of a Stata string scalar.- Parameters:
- name- Name of the scalar.
- Returns:
- Value of the scalar. Returns null if the scalar is not found or if the scalar is marked as binary.
 
- 
getStringGet the contents of a Stata string scalar.- Parameters:
- name- Name of the scalar.
- type- Type of the scalar; may be- TYPE_AUTOMATIC,- TYPE_GLOBAL, or- TYPE_CRETURN.
- Returns:
- Value of the scalar. Returns null if the scalar is not found or if the scalar is marked as binary.
 
- 
getValueGet the contents of a Stata scalar.- Parameters:
- name- Name of the scalar.
- Returns:
- Value of the scalar. Returns null if the scalar is not found.
 
- 
getValueGet the contents of a Stata scalar.- Parameters:
- name- Name of the scalar.
- type- Type of the scalar; may be- TYPE_AUTOMATIC,- TYPE_GLOBAL,- TYPE_RETURN,- TYPE_RRETURN,- TYPE_ERETURN, or- TYPE_CRETURN.
- Returns:
- Value of the scalar. Returns null if the scalar is not found.
 
- 
setStringSet the contents of a Stata string scalar.- Parameters:
- name- Name of the scalar.
- value- Value to store in the scalar.
- Returns:
- Return code from Stata; 0 if successful.
 
- 
setStringSet the contents of a Stata string scalar.- Parameters:
- name- Name of the scalar.
- value- Value to store in the scalar.
- type- Type of the scalar; may be- TYPE_AUTOMATICor- TYPE_GLOBAL.
- Returns:
- Return code from Stata; 0 if successful.
 
- 
setValueSet the value of a Stata scalar. If necessary, the scalar will be created.- Parameters:
- name- Name of the scalar.
- val- Value to store in the scalar.
- Returns:
- Return code from Stata; 0 if successful.
 
- 
setValueSet the value of a Stata scalar. If necessary, the scalar will be created.- Parameters:
- name- Name of the scalar.
- value- Value to store in the scalar.
- type- Type of the scalar; may be- TYPE_AUTOMATIC,- TYPE_GLOBAL,- TYPE_RETURN,- TYPE_RRETURN, or- TYPE_ERETURN.
- Returns:
- Return code from Stata; 0 if successful.
 
- 
setValueSet the value of a Stata scalar. If necessary, the scalar will be created.- Parameters:
- name- Name of the scalar.
- value- Value to store in the scalar.
- type- Type of the scalar; may be- TYPE_AUTOMATIC,- TYPE_GLOBAL,- TYPE_RETURN,- TYPE_RRETURN, or- TYPE_ERETURN.
- vtype- If the scalar is a type of return value, sets whether the return value is- VTYPE_VISIBLE,- VTYPE_HIDDEN, or- VTYPE_HISTORICAL. This parameter is ignored with- TYPE_GLOBAL.
- Returns:
- Return code from Stata; 0 if successful.
 
- 
setValueSet the value of a Stata scalar. If necessary, the scalar will be created.- Parameters:
- name- Name of the scalar.
- value- Value to store in the scalar.
- type- Type of the scalar; may be- TYPE_GLOBAL,- TYPE_RETURN,- TYPE_RRETURN, or- TYPE_ERETURN.
- version- If the scalar is a type of return value, sets the release number in the form #[#][.[#[#]]] for a return result. This parameter is ignored with- TYPE_GLOBAL.
- Returns:
- Return code from Stata; 0 if successful.
 
 
-