|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.stata.sfi.Data
public final class Data
Routines for interacting with a Stata dataset.
Field Summary | |
---|---|
static int |
TYPE_BYTE
|
static int |
TYPE_DOUBLE
|
static int |
TYPE_FLOAT
|
static int |
TYPE_INT
|
static int |
TYPE_LONG
|
static int |
TYPE_STR
|
static int |
TYPE_STRL
|
Method Summary | |
---|---|
static int |
addVarByte(String name)
Add a variable of type byte to the current Stata dataset. |
static int |
addVarDouble(String name)
Add a variable of type double to the current Stata dataset. |
static int |
addVarFloat(String name)
Add a variable of type float to the current Stata dataset. |
static int |
addVarInt(String name)
Add a variable of type int to the current Stata dataset. |
static int |
addVarLong(String name)
Add a variable of type long to the current Stata dataset. |
static int |
addVarStr(String name,
int length)
Add a variable of type str to the current Stata dataset. |
static int |
addVarStrL(String name)
Add a variable of type strL to the current Stata dataset. |
static int |
dropVar(int index)
Drop the variable at the specified variable index. |
static int |
getBestType(double value)
Get the best numeric data type for the specified value. |
static String |
getFormattedValue(int var,
int obs,
boolean bValueLabel)
Read a value from the current Stata dataset applying its display format. |
static int |
getMaxStrLength()
Get the maximum length of a Stata string (str) variable. |
static int |
getMaxVars()
Get the maximum number of variables Stata currently allows. |
static double |
getMissingValue()
Get a Stata missing value. |
static double |
getNum(int var,
int obs)
Read a numeric value from the current Stata dataset. |
static int |
getObsCount()
Get the number of observations in the current Stata dataset. |
static int |
getParsedIn1()
Get the first in a range of observations if javacall was called with the in qualifier. |
static int |
getParsedIn2()
Get the last in a range of observations if javacall was called with the in qualifier. |
static int |
getParsedVarCount()
Get the number of variables specified when javacall was called. |
static Double |
getRealOfString(String s)
Get the double representation of a String using Stata's real() function. |
static String |
getStr(int var,
int obs)
Read a string value from the current Stata dataset. |
static int |
getVarCount()
Get the number of variables in the current Stata dataset. |
static String |
getVarFormat(int index)
Get the format for a Stata variable. |
static int |
getVarIndex(String varname)
Look up the variable index for the specified name in the current Stata dataset. |
static String |
getVarLabel(int index)
Get the label for a Stata variable. |
static String |
getVarName(int index)
Get the variable name at a given variable index. |
static boolean |
isParsedIfTrue(int obs)
Determine if the observation is true given an if condition specified with javacall. |
static boolean |
isValueMissing(double value)
Test if a value is a Stata missing. |
static boolean |
isVarlistSpecified()
Determine if a varlist was specified with javacall. |
static boolean |
isVarTypeStr(int index)
Test if a variable is of type str. |
static boolean |
isVarTypeString(int index)
Test if a variable is string or numeric. |
static boolean |
isVarTypeStrL(int index)
Test if a variable is of type strL. |
static String |
makeVarName(String s,
boolean retainCase)
Attempt to form a valid variable name from a string. |
static int |
mapParsedVarIndex(int index)
Map the variable index from the parsed varlist. |
static int |
renameVar(int index,
String newname)
Rename a Stata variable. |
static int |
setObsCount(int obs)
Set the number of observations in the current Stata dataset. |
static int |
setVarFormat(int index,
String format)
Set the format for a Stata variable. |
static int |
setVarLabel(int index,
String label)
Set the label for a Stata variable. |
static int |
storeNum(int var,
int obs,
double value)
Store a numeric value in the current Stata dataset. |
static int |
storeStr(int var,
int obs,
String value)
Store a string value in the current Stata dataset. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TYPE_BYTE
public static final int TYPE_INT
public static final int TYPE_LONG
public static final int TYPE_FLOAT
public static final int TYPE_DOUBLE
public static final int TYPE_STR
public static final int TYPE_STRL
Method Detail |
---|
public static double getNum(int var, int obs)
var
- Variable to access.obs
- Observation to access.
public static String getStr(int var, int obs)
var
- Variable to access.obs
- Observation to access.
public static String getFormattedValue(int var, int obs, boolean bValueLabel)
var
- Variable to access.obs
- Observation to access.
public static int storeNum(int var, int obs, double value)
var
- Variable to access.obs
- Observation to access.value
- Value to store.
public static int storeStr(int var, int obs, String value)
var
- Variable to access.obs
- Observation to access.value
- Value to store.
public static int getVarCount()
public static int getObsCount()
public static int setObsCount(int obs)
obs
- The number of observations to set.
public static int getBestType(double value)
value
- The value to test.
TYPE_BYTE
, TYPE_INT
, TYPE_LONG
,
TYPE_FLOAT
, or TYPE_DOUBLE
.public static int addVarDouble(String name)
name
- Name of the variable to be created.
public static int addVarFloat(String name)
name
- Name of the variable to be created.
public static int addVarLong(String name)
name
- Name of the variable to be created.
public static int addVarInt(String name)
name
- Name of the variable to be created.
public static int addVarByte(String name)
name
- Name of the variable to be created.
public static int addVarStr(String name, int length)
name
- Name of the variable to be created.length
- Initial size of the variable. If the length is
greater than getMaxStrLength
then a variable of type strL will be created.
public static int addVarStrL(String name)
name
- Name of the variable to be created.
public static int getVarIndex(String varname)
varname
- Name of the variable.
public static String getVarName(int index)
index
- Index of the variable to lookup.
public static int renameVar(int index, String newname)
index
- Index of the variable to rename.newname
- New variable name.
public static String getVarLabel(int index)
index
- Index of the variable to lookup.
public static int setVarLabel(int index, String label)
index
- Index of the variable to label.label
- New label.
public static String getVarFormat(int index)
index
- Index of the variable to lookup.
public static int setVarFormat(int index, String format)
index
- Index of the variable to format.format
- New format.
public static int dropVar(int index)
index
- Variable to drop.
public static String makeVarName(String s, boolean retainCase)
s
- Source string.retainCase
- If set, the case will not be converted to
lowercase.
public static int getMaxStrLength()
public static int getMaxVars()
public static boolean isVarTypeString(int index)
index
- The index of the variable to test.
public static boolean isVarTypeStr(int index)
index
- The index of the variable to test.
public static boolean isVarTypeStrL(int index)
index
- The index of the variable to test.
public static boolean isValueMissing(double value)
value
- The value to test.
public static double getMissingValue()
public static Double getRealOfString(String s)
s
- The string to convert.
public static int getParsedIn1()
public static int getParsedIn2()
public static boolean isVarlistSpecified()
public static int getParsedVarCount()
public static int mapParsedVarIndex(int index)
index
- Parsed variable index.
public static boolean isParsedIfTrue(int obs)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |