示例#1
0
 /// <summary>
 /// Gets the missing values of a short string variable.
 /// </summary>
 /// <param name="handle">
 /// Handle to the data file.
 /// </param>
 /// <param name="varName">
 /// Variable name.
 /// </param>
 /// <param name="missingFormat">
 /// Missing value format code.
 /// </param>
 /// <param name="missingVal1">
 /// First missing value.
 /// </param>
 /// <param name="missingVal2">
 /// Second missing value.
 /// </param>
 /// <param name="missingVal3">
 /// Third missing value.
 /// </param>
 /// <returns>
 /// <see cref="ReturnCode.SPSS_OK"/>,
 /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
 /// <see cref="ReturnCode.SPSS_INVALID_VARNAME"/>, 
 /// <see cref="ReturnCode.SPSS_VAR_NOTFOUND"/>,
 /// <see cref="ReturnCode.SPSS_STR_EXP"/>, or
 /// <see cref="ReturnCode.SPSS_SHORTSTR_EXP"/>.
 /// </returns>
 /// <remarks>
 /// This function reports the missing values of a short string variable. The value of
 /// <paramref>missingFormat</paramref> will indicate 
 /// the number of missing values. The
 /// appropriate number of missing values is copied to the <paramref>missingVal1</paramref>,
 /// <paramref>missingVal2</paramref>, and <paramref>missingVal3</paramref> parameters. 
 /// </remarks>
 public static ReturnCode spssGetVarCMissingValues(int handle, string varName, out MissingValueFormatCode missingFormat, out string missingVal1, out string missingVal2, out string missingVal3)
 {
     missingVal1 = new string(' ', SPSS_MAX_SHORTSTRING + 1);
     missingVal2 = new string(' ', SPSS_MAX_SHORTSTRING + 1);
     missingVal3 = new string(' ', SPSS_MAX_SHORTSTRING + 1);
     ReturnCode result = SpssThinWrapper.spssGetVarCMissingValuesImpl(handle, ref varName, out missingFormat,
         ref missingVal1, ref missingVal2, ref missingVal3);
     if (missingFormat < MissingValueFormatCode.SPSS_THREE_MISSVAL)
         missingVal3 = null;
     else
         missingVal3 = (result == ReturnCode.SPSS_OK) ? missingVal3.Substring(0, missingVal3.IndexOf('\0')) : null;
     if (missingFormat < MissingValueFormatCode.SPSS_TWO_MISSVAL)
         missingVal2 = null;
     else
         missingVal2 = (result == ReturnCode.SPSS_OK) ? missingVal2.Substring(0, missingVal2.IndexOf('\0')) : null;
     if (missingFormat < MissingValueFormatCode.SPSS_ONE_MISSVAL)
         missingVal1 = null;
     else
         missingVal1 = (result == ReturnCode.SPSS_OK) ? missingVal1.Substring(0, missingVal1.IndexOf('\0')) : null;
     return result;
 }
示例#2
0
 /// <summary>
 /// Gets the missing values of a numeric variable.
 /// </summary>
 /// <param name="handle">
 /// Handle to the data file.
 /// </param>
 /// <param name="varName">
 /// Variable name.
 /// </param>
 /// <param name="missingFormat">
 /// Missing value format code.
 /// </param>
 /// <param name="missingVal1">
 /// First missing value.
 /// </param>
 /// <param name="missingVal2">
 /// Second missing value.
 /// </param>
 /// <param name="missingVal3">
 /// Third missing value.
 /// </param>
 /// <returns>
 /// <see cref="ReturnCode.SPSS_OK"/>,
 /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
 /// <see cref="ReturnCode.SPSS_INVALID_VARNAME"/>, 
 /// <see cref="ReturnCode.SPSS_VAR_NOTFOUND"/>, or
 /// <see cref="ReturnCode.SPSS_NUME_EXP"/>.
 /// </returns>
 /// <remarks>
 /// This function reports the missing values of a numeric variable. The value of
 /// <paramref>missingFormat</paramref> determines the interpretation of 
 /// <paramref>missingVal1</paramref>, <paramref>missingVal2</paramref>, and
 /// <paramref>missingVal3</paramref>. If missingFormat is SPSS_MISS_RANGE, 
 /// <paramref>missingVal1</paramref> and <paramref>missingVal2</paramref>
 /// represent the upper and lower limits, respectively, of the range, and 
 /// <paramref>missingVal3</paramref> is not used. If missingFormat is 
 /// SPSS_MISS_RANGEANDVAL, <paramref>missingVal1</paramref> and 
 /// <paramref>missingVal2</paramref> represent the range and 
 /// <paramref>missingVal3</paramref> is the discrete missing value. 
 /// If missingFormat is neither of the above, it will be in the range 
 /// 0–3, indicating the number of discrete missing
 /// values present. (The macros SPSS_NO_MISSVAL, SPSS_ONE_MISSVAL,
 /// SPSS_TWO_MISSVAL, and SPSS_THREE_MISSVAL may be used as synonyms for 0–3.)
 /// </remarks>
 public static ReturnCode spssGetVarNMissingValues(int handle, string varName, out MissingValueFormatCode missingFormat, out double missingVal1, out double missingVal2, out double missingVal3)
 {
     return SpssThinWrapper.spssGetVarNMissingValuesImpl(handle, ref varName, out missingFormat, out missingVal1, out missingVal2, out missingVal3);
 }
示例#3
0
 /// <summary>
 /// Sets missing values for a short string variable.
 /// </summary>
 /// <param name="handle">
 /// Handle to the data file.
 /// </param>
 /// <param name="varName">
 /// Variable name.
 /// </param>
 /// <param name="missingFormat">
 /// The number of missing values (0-3) actually supplied.
 /// </param>
 /// <param name="missingVal1">
 /// First missing value.
 /// </param>
 /// <param name="missingVal2">
 /// Second missing value.
 /// </param>
 /// <param name="missingVal3">
 /// Third missing value.
 /// </param>
 /// <returns>
 /// <see cref="ReturnCode.SPSS_OK"/>,
 /// <see cref="ReturnCode.SPSS_INVALID_HANDLE"/>,
 /// <see cref="ReturnCode.SPSS_OPEN_RDMODE"/>,
 /// <see cref="ReturnCode.SPSS_DICT_COMMIT"/>,
 /// <see cref="ReturnCode.SPSS_INVALID_VARNAME"/>,
 /// <see cref="ReturnCode.SPSS_VAR_NOTFOUND"/>,
 /// <see cref="ReturnCode.SPSS_STR_EXP"/>,
 /// <see cref="ReturnCode.SPSS_SHORTSTR_EXP"/>,
 /// <see cref="ReturnCode.SPSS_INVALID_MISSFOR"/>,
 /// <see cref="ReturnCode.SPSS_EXC_STRVALUE"/>, or
 /// <see cref="ReturnCode.SPSS_NO_MEMORY"/>.
 /// </returns>
 /// <remarks>
 /// This function sets missing values for a short string variable. The argument
 /// missingFormat must be set to a value in the range 0–3 to indicate the number of missing
 /// values supplied. When fewer than three missing values are to be defined, the redundant
 /// arguments must still be present, although their values are not inspected. For example,
 /// if missingFormat is 2, missingVal3 is unused. The supplied missing values must be nullterminated
 /// and not longer than the length of the variable unless the excess length is
 /// made up of blanks, which are ignored. If the missing value is shorter than the length of
 /// the variable, trailing blanks are assumed.
 /// </remarks>
 public static ReturnCode spssSetVarCMissingValues(int handle, string varName, MissingValueFormatCode missingFormat, string missingVal1, string missingVal2, string missingVal3)
 {
     return SpssThinWrapper.spssSetVarCMissingValuesImpl(handle, ref varName, missingFormat,
         ref missingVal1, ref missingVal2, ref missingVal3);
 }