- if (ext->dict->weight_var[0] != 0
- && !find_dict_variable (ext->dict, ext->dict->weight_var))
- lose ((h, _("Weighting variable %s not present in dictionary."),
- ext->dict->weight_var));
+ if (weight_name != NULL)
+ {
+ struct variable *weight_var = dict_lookup_var (ext->dict, weight_name);
+ if (weight_var == NULL)
+ lose ((h, _("Weighting variable %s not present in dictionary."),
+ weight_name));
+ free (weight_name);
+
+ dict_set_weight (ext->dict, weight_var);
+ }