[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: data_out return status

From: Ben Pfaff
Subject: Re: data_out return status
Date: Sun, 20 Nov 2005 11:12:17 -0800
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> writes:

> Can we therefore add a transformation in the pspp code which converts
> variables between arbitrary types/formats ?  It should do this by
> applying data_out ; data_in.  If either of them fail, then it sets the
> value to SYSMIS (or "" if the target type is string).

I'm nervous about this as a transformation.  One reason is that
changing a variable to a "long string" type could require moving
it around in the case array.  That'd be okay if transformations
before the "change" looked in the old location and
transformations after it looked in the new location, but that's
not the current behavior--a lot of transformations will just keep
a pointer to the `struct variable' and look up `fv' through that,
so behavior would be unpredictable in general.

Another reason is interaction with DO IF and LOOP.  Conversion
must happen exactly once, but DO IF and LOOP could interfere with

However, as a procedure it would make sense in my opinion.  It
could be another subcommand on MODIFY VARS, for example.  (MODIFY
VARS sometimes just updates the dictionary and other times acts
as a procedure, for similar reasons.)

You can already accomplish something similar, however, with
multiple commands, e.g. to convert string to numeric
        COMPUTE x2 = NUMBER(x, F8.2).   /* or whatever format
        RENAME VARS x2=x.
(Other properties of the variable, like value labels, wouldn't be
propagated, which might be a reason to add a new way to do it.)

Actually, what *should* happen to value labels in converting
between variable types?
Ben Pfaff 
email: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]