public final class Data extends Object
Modifier and Type | Field and Description |
---|---|
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 |
Modifier and Type | Method and Description |
---|---|
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)
Deprecated.
|
static String |
getFormattedValue(int var,
long 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 variable of type str.
|
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)
Deprecated.
|
static double |
getNum(int var,
long obs)
Read a numeric value from the current Stata dataset.
|
static int |
getObsCount()
Deprecated.
|
static long |
getObsParsedIn1()
Get the first in a range of observations if javacall was
called with the in qualifier.
|
static long |
getObsParsedIn2()
Get the last in a range of observations if javacall was
called with the in qualifier.
|
static long |
getObsTotal()
Get the number of observations in the current Stata dataset.
|
static int |
getParsedIn1()
Deprecated.
|
static int |
getParsedIn2()
Deprecated.
|
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)
Deprecated.
|
static String |
getStr(int var,
long obs)
Read a string value from the current Stata dataset.
|
static int |
getStrVarWidth(int index)
Get the width of a variable of type str.
|
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)
Deprecated.
|
static boolean |
isParsedIfTrue(long 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)
Deprecated.
|
static int |
setObsTotal(long 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)
Deprecated.
|
static int |
storeNum(int var,
long obs,
double value)
Store a numeric value in the current Stata dataset.
|
static int |
storeStr(int var,
int obs,
String value)
Deprecated.
|
static int |
storeStr(int var,
long obs,
String value)
Store a string value in the current Stata dataset.
|
public static final int TYPE_BYTE
public static final int TYPE_DOUBLE
public static final int TYPE_FLOAT
public static final int TYPE_INT
public static final int TYPE_LONG
public static final int TYPE_STR
public static final int TYPE_STRL
public static int addVarByte(String name)
name
- Name of the variable to be created.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 addVarInt(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 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 dropVar(int index)
index
- Variable to drop.public static int getBestType(double value)
value
- The value to test.TYPE_BYTE
, TYPE_INT
, TYPE_LONG
,
TYPE_FLOAT
, or TYPE_DOUBLE
.@Deprecated public static String getFormattedValue(int var, int obs, boolean bValueLabel)
var
- Variable to access.obs
- Observation to access.public static String getFormattedValue(int var, long obs, boolean bValueLabel)
var
- Variable to access.obs
- Observation to access.public static int getMaxStrLength()
public static int getMaxVars()
public static double getMissingValue()
@Deprecated public static double getNum(int var, int obs)
var
- Variable to access.obs
- Observation to access.public static double getNum(int var, long obs)
var
- Variable to access.obs
- Observation to access.@Deprecated public static int getObsCount()
public static long getObsParsedIn1()
public static long getObsParsedIn2()
public static long getObsTotal()
@Deprecated public static int getParsedIn1()
@Deprecated public static int getParsedIn2()
public static int getParsedVarCount()
public static Double getRealOfString(String s)
s
- The string to convert.@Deprecated public static String getStr(int var, int obs)
var
- Variable to access.obs
- Observation to access.public static String getStr(int var, long obs)
var
- Variable to access.obs
- Observation to access.public static int getStrVarWidth(int index)
index
- The index of the variable to test.public static int getVarCount()
public static String getVarFormat(int index)
index
- Index of the variable to look up.public static int getVarIndex(String varname)
varname
- Name of the variable.public static String getVarLabel(int index)
index
- Index of the variable to look up.public static String getVarName(int index)
index
- Index of the variable to look up.@Deprecated public static boolean isParsedIfTrue(int obs)
public static boolean isParsedIfTrue(long obs)
public static boolean isValueMissing(double value)
value
- The value to test.public static boolean isVarlistSpecified()
public static boolean isVarTypeStr(int index)
index
- The index of the variable to test.public static boolean isVarTypeString(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 String makeVarName(String s, boolean retainCase)
s
- Source string.retainCase
- If set, the case will not be converted to
lowercase.public static int mapParsedVarIndex(int index)
index
- Parsed variable index.public static int renameVar(int index, String newname)
index
- Index of the variable to rename.newname
- New variable name.@Deprecated public static int setObsCount(int obs)
obs
- The number of observations to set.public static int setObsTotal(long obs)
obs
- The number of observations to set.public static int setVarFormat(int index, String format)
index
- Index of the variable to format.format
- New format.public static int setVarLabel(int index, String label)
index
- Index of the variable to label.label
- New label.@Deprecated 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 storeNum(int var, long obs, double value)
var
- Variable to access.obs
- Observation to access.value
- Value to store.@Deprecated 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 storeStr(int var, long obs, String value)
var
- Variable to access.obs
- Observation to access.value
- Value to store.