Automatically compute variable upon input in SPSS

classic Classic list List threaded Threaded
3 messages Options
mk
Reply | Threaded
Open this post in threaded view
|

Automatically compute variable upon input in SPSS

mk
I have a table with two columns a and b. I manually enter data into a cell in column a, and I want the corresponding cell in column b automatically show a value caluclated from my input in a.

E.g. a is a number and b = 2 * a. In Excel I can define this behavior easily. In SPSS I only know how to do this manually (by Transform > Compute ...), but that way the cell only shows the computed value after I manually call this function.

How can I set up column b to compute automatically, upon input?
Reply | Threaded
Open this post in threaded view
|

Re: Automatically compute variable upon input in SPSS

David Marso
Administrator
It does not work that way!
--
mk wrote
I have a table with two columns a and b. I manually enter data into a cell in column a, and I want the corresponding cell in column b automatically show a value caluclated from my input in a.

E.g. a is a number and b = 2 * a. In Excel I can define this behavior easily. In SPSS I only know how to do this manually (by Transform > Compute ...), but that way the cell only shows the computed value after I manually call this function.

How can I set up column b to compute automatically, upon input?
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Automatically compute variable upon input in SPSS

Richard Ristow
In reply to this post by mk
At 12:33 PM 10/4/2012, mk wrote:

>I have a table with two columns a and b. I manually enter data into
>a cell in column a, and I want the corresponding cell in column b
>automatically show a value calculated from my input in a: e.g. a is
>a number and b = 2*a. In Excel I can define this behavior easily. In
>SPSS I only know how to do this manually (by Transform > Compute
>...), but that way the cell only shows the computed value after I
>manually call this function.

As David Marso writes, you can't. SPSS isn't a spreadsheet program,
even though the Data Editor looks like a spreadsheet. SPSS is
oriented toward doing computations for a whole file at a time, rather
than for each value as it's entered.

Commonly, people enter the data in the Data Editor or (more often) in
an external file and then read it in, and write syntax programs for
whatever computations they need. Then they run the syntax programs
after each new batch of data is entered.

You might create a dataset called My_Input containing only variable
a, and create a syntax program like,

ADD FILES
   /FILE=My_Input.
COMPUTE b=2*a.
DATASET NAME My_Calculations.

Then, whenever you're finished entering all the values of a in
My_Input, you run that program and the calculations are done.

If you're only using a little data and you want to see your
computations immediately, this is clumsier than Excel; by all means
use Excel, if you want to. SPSS's approach is much more efficient for
large files, and it's less prone to errors, because you can read the
exact syntax that was used in the computations. (In Excel, there's a
separate formula in each cell that's computed, even though you can
create them all by copying from an original formula; it's easy to
miss an error that slips in in one of the rows of a long file.)

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD