SPSS Data File Input/Output API, страница 2

SPSS_INVALID_VARNAME       One or more variable names in list are invalid

SPSS_VAR_NOTFOUND          One or more variables in list were not found in dictionary

SPSS_SHORTSTR_EXP          At least one variable in the list is numeric or long string

SPSS_NO_MEMORY             Insufficient memory to store the definition


For numeric variables, use:

int spssAddMultRespDefN(
    int handle,
    const char *mrSetName,
    const char *mrSetLabel,
    int isDichotomy,
    long countedValue,
    const char **varNames,
    int numVars)

This function adds a multiple response set definition over numeric variables to the dictionary.

Parameter                                          Description

handle                     Handle to the data file

mrSetName                                        Name of the multiple response set. A null-terminated string up to seven characters long but otherwise obeying the rules for a valid variable name. Case is immaterial.

mrSetLabel                                      Label for the multiple response set. A null-terminated string up to 60 characters long; only the first 60 characters are used if longer. May be NULL or the empty string to indicate no label is desired.

isDichotomy                                    Nonzero if the variables in the set are coded as dichotomies, zero otherwise.

countedValue                                  The counted value. Necessary when isDichotomy is nonzero and ignored otherwise. Note that the value is specified as a long int, not a double.

varNames                                          Array of null-terminated strings containing the names of the variables in the set. All variables in the list must be numeric. Case is immaterial.

numVars                                             Number of variables in the list (in varNames). Must be at least two.

If all goes well, adds the multiple response set to the dictionary and returns zero (SPSS_OK) or negative (a warning). Otherwise, returns a positive error code and does not add anything to the multiple response sets already defined, if any.

Error Code                                         Description

SPSS_OK                    No error

SPSS_EXC_LEN60             Only the first 60 characters of the label were used (warning)

SPSS_INVALID_HANDLE        The file handle is not valid

SPSS_OPEN_RDMODE           The file is open for input or append

SPSS_DICT_COMMIT           spssCommitHeader has already been called

SPSS_NO_VARIABLES          Fewer than two variables in list

SPSS_INVALID_MRSETNAME     The multiple response set name is invalid

SPSS_DUP_MRSETNAME         The multiple response set name is a duplicate

SPSS_INVALID_MRSETDEF      Existing multiple response set definitions are invalid

SPSS_INVALID_VARNAME       One or more variable names in list are invalid

SPSS_VAR_NOTFOUND          One or more variables in list were not found in dictionary

SPSS_NUME_EXP              At least one variable in the list is not numeric

SPSS_NO_MEMORY             Insufficient memory to store the definition


int spssQueryType7(
    const int handle,
    const int subType,
    int* bFound)

This function can be used to determine whether a file opened for reading or append contains a specific “type 7” record.  The following type 7 subtypes might be of interest:

Subtype 3 – release information

Subtype 4 – floating point constants including the system missing value

Subtype 5 – variable set definitions

Subtype 6 – date variable information

Subtype 7 – multiple response set definitions

Subtype 8 – Data Entry for Windows (DEW) information

Subtype 10 – TextSmart information

Subtype 11 – measurement level, column width, and alignment for each variable

Subtype 12 – uniqueness indicator for DEW

Parameter                                          Description

handle                     Handle to the data file

subtype                    Specific subtype record

bFound                     Returned set if the specified subtype was encountered

The result of the query is returned in parameter bfound – TRUE if the record subtype was encountered when reading the file’s dictionary, FALSE otherwise.

Error Code                                         Description

SPSS_OK                    No error

SPSS_INVALID_HANDLE        The file handle is not valid