Wuensch, Karl L wrote:
> SPSS has a NMISS function, so you might be able to accomplish this in 
> essentially the same way that I do in SAS.  Also consider using the 
> MEAN.n function.  I don't know if there is a SUM.n function in SPSS.  
> See http://core.ecu.edu/psyc/wuenschk/SAS/Help/NMISS-SAS.txt and 
> http://core.ecu.edu/psyc/wuenschk/SAS/Help/Sum-SAS.txt.  Let me know 
> what works.
>  
> Karl W.
> 
>     -----Original Message-----
>     *From:* Lise DeShea [mailto:[EMAIL PROTECTED]
>     *Sent:* Monday, June 30, 2003 4:22 PM
>     *To:* [EMAIL PROTECTED]
>     *Subject:* simple question re SPSS
> 
>     List mates:
> 
>     I have such an easy question that I can't believe I'm asking it. 
>     It's so simple that I guess SPSS's web people could never fathom
>     that someone would need to ask.
> 
>     I've coded missing data as "-1."  I've specified in the Variable
>     View that "-1" stands for missing data.  I want to create new
>     variables (summing items on a scale).  I've written the syntax:
>     ~~~
>     COMPUTE GRAT = SUM (g101, g102, g103r, g104, g105, g106r).
>     VARIABLE LABEL GRAT 'GQ6 Gratitude Scale'.
>     FORMAT GRAT (f1.0).
>     EXECUTE.
>     ~~~
>     But I need to specify that if one of the variables in the SUM
>     statement has a missing value, then the new variable GRAT also
>     should be missing.  How do I do that?

As Karl suggests, there is a SUM.N function (under COMPUTE 
in the help files).  For example, i defined 9 as missing in 
the following:

ID Q1 Q2 Q3 SUM1 SUM2

  1  2  3  4   9    9
  2  1  3  2   6    6
  3  4  4  9   8    .

* Create a couple of new (computed) variables.

compute sum1 = sum(q1 to q3).
compute sum2 = sum.3(q1 to q3).
exe.
format sum1 sum2 (f2.0).
list.

ID Q1 Q2 Q3 SUM1 SUM2

  1  2  3  4   9    9
  2  1  3  2   6    6
  3  4  4  9   8    .  <-- missing for SUM2

Cheers,
Bruce
-- 
Bruce Weaver
[EMAIL PROTECTED]
www.angelfire.com/wv/bwhomedir/

.
.
=================================================================
Instructions for joining and leaving this list, remarks about the
problem of INAPPROPRIATE MESSAGES, and archives are available at:
.                  http://jse.stat.ncsu.edu/                    .
=================================================================

Reply via email to