Seppo Mustonen : Programming Survo in C

Functions in library SURVO.LIB

data_save
Summary

int data_save(data,j,i,x)
SURVO_DATA *data; /* pointer to SURVO 84C data structure */
long j;           /* # of observation (record) */
int i;            /* # of variable (field) */
double x;         /* value to be saved */
Description

The data_save function saves the value x of the jth observation in variable # i (i=0,1,...,data->m-1) for data opened by any of the data opening functions (data_read_open, data_open3 etc).

Only numeric values can be saved by data_save. If the field for saving is a string field, value x is converted to a number. For proper saving of string variables, use data_alpha_save.

Return Value

data_save returns -1 if the field for saving is protected or the data representation does not permit saving.

See Also

data_alpha_save, data_load, create_newvar

Example

int i;
long j;
SURVO_DATA dat;

i=data_open("TEST",&dat);
if (i<0) return;
for (j=1L; j<=dat.n; ++j)
        data_save(&dat,j,3,MISSING8);

/* open TEST and save missing values in
   all observations of field #3 */


Front page of Survo C libraries