for the new value in the target variable. Otherwise, the source value
itself becomes each new value's label.
+Variable labels are copied from the source to target variables.
+
@subcmd{PRINT} is currently ignored.
The @subcmd{GROUP} subcommand is relevant only if more than one variable is to be
int src_idx; /* Case index of source variable. */
struct variable *dst; /* Target variable. */
struct missing_values mv; /* Missing values of source variable. */
+ char *label; /* Variable label of source variable. */
struct rec_items *items;
};
spec->width = var_get_width (src_vars[i]);
spec->src_idx = var_get_case_index (src_vars[i]);
+ const char *label = var_get_label (src_vars[i]);
+ spec->label = label ? xstrdup (label) : NULL;
+
if (group && i > 0)
spec->items = arc->specs[0].items;
else
/* Create destination variable. */
spec->dst = dict_create_var_assert (dict, dst_names[i], 0);
+ var_set_label (spec->dst, spec->label);
/* Create array of pointers to items. */
n_items = hmap_count (&spec->items->ht);
hmap_delete (&spec->items->ht, &item->hmap_node);
free (item);
}
+ free (spec->label);
mv_destroy (&spec->mv);
}
oojimiflips 7
end data.
+variable labels s 'tracking my stuff'.
value labels /s 'thingummies' 'Funny sticky things'.
autorecode s into new.
Table: Variables
Name,Position,Label,Measurement Level,Role,Width,Alignment,Print Format,Write Format,Missing Values
-new,3,,Scale,Input,8,Right,F8.2,F8.2,
+new,3,tracking my stuff,Scale,Input,8,Right,F8.2,F8.2,
Table: Value Labels
Variable Value,,Label
-new,1.00,oojars
+tracking my stuff,1.00,oojars
,2.00,oojimiflips
,3.00,Funny sticky things
,4.00,widgets