syntax to compute a variable

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

syntax to compute a variable

Johnny Amora
Hi all,
 
Consider the syntax:
 
DESCRIPTIVES
VARIABLES=ENGLISH /SAVE
/STATISTICS=MEAN STDDEV MIN MAX.
Compute English_Tscore = 10*ZEnglish + 50.
Execute.
 
The first three lines invoke spss to add a ZENGLISH variable in the active dataset, then print the descriptive statistics of the ENGLISH variable.  What command is inserted so that my only output is the result of the compute command?  That is, the ZENGLISH will not appear on the active dataset and spss does not provide the descriptive statistics.  The only output is the English_Tscore added in the active data set.
 
You may modify my syntax if you dont like as long as it generates the desired output.
 
Thank you in advance.
 
Johnny
 
 


      New Email addresses available on Yahoo!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/ph/

====================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
Reply | Threaded
Open this post in threaded view
|

Re: syntax to compute a variable

Dennis Deck
One approach would be to use AGGREGATE to compute the group statistics.
You implied that you only have one group you want statistics for but this could easily be extended to calculate statistics for multiple subgroups.

* define dummy break variable .
COMPUTE Group = 1 .

* compute statistics .
DATASET DECLARE Means .
AGGREGATE File= * /Break= Group
 /Mean= MEAN(English)
 /SD=   SD(English)
 /Min=  MIN(English)
 /Max=  MAX(English) .

* merge with statistics .
MATCH FILES
  File=*
 /Table= Means
   /by= All .



Dennis Deck, PhD
RMC Research Corporation
111 SW Columbia Street, Suite 1200
Portland, Oregon 97201-5843
voice: 503-223-8248 x715
voice: 800-788-1887 x715
fax:  503-223-8399
[hidden email]

-----Original Message-----
From: Johnny Amora [mailto:[hidden email]]
Sent: Tuesday, October 21, 2008 8:11 PM
Subject: syntax to compute a variable

Hi all,

Consider the syntax:

DESCRIPTIVES
VARIABLES=ENGLISH /SAVE
/STATISTICS=MEAN STDDEV MIN MAX.
Compute English_Tscore = 10*ZEnglish + 50.
Execute.

The first three lines invoke spss to add a ZENGLISH variable in the active dataset, then print the descriptive statistics of the ENGLISH variable.  What command is inserted so that my only output is the result of the compute command?  That is, the ZENGLISH will not appear on the active dataset and spss does not provide the descriptive statistics.  The only output is the English_Tscore added in the active data set.

You may modify my syntax if you dont like as long as it generates the desired output.

Thank you in advance.

Johnny




      New Email addresses available on Yahoo!
Get the Email name you've always wanted on the new @ymail and @rocketmail.
Hurry before someone else does!
http://mail.promotions.yahoo.com/newdomains/ph/

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: syntax to compute a variable

Marta Garcia-Granero
In reply to this post by Johnny Amora
Johnny Amora wrote:
> Consider the syntax:
>
> DESCRIPTIVES
> VARIABLES=ENGLISH /SAVE
> /STATISTICS=MEAN STDDEV MIN MAX.
> Compute English_Tscore = 10*ZEnglish + 50.
> Execute.
>
> The first three lines invoke spss to add a ZENGLISH variable in the active dataset, then print the descriptive statistics of the ENGLISH variable.  What command is inserted so that my only output is the result of the compute command?  That is, the ZENGLISH will not appear on the active dataset and spss does not provide the descriptive statistics.  The only output is the English_Tscore added in the active data set.
Is this what you want?

* Stop all output *.
PRESERVE.
SET ERRORS=NONE RESULTS=NONE.
DESCRIPTIVES
VARIABLES=ENGLISH /SAVE
/STATISTICS=MEAN STDDEV MIN MAX.
Compute English_Tscore = 10*ZEnglish + 50.
Execute.
* Output is restored *.
RESTORE.
* Elimination of the unwanted variable.
DELETE VARIABLES ZEnglish.

--
For miscellaneous statistical stuff, visit:
http://gjyp.nl/marta/

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: syntax to compute a variable

Albert-Jan Roskam
In reply to this post by Dennis Deck
Hi,

One remark and one question:
You might be able to skip the MATCH step by using MODE=ADDVARIABLES in the AGGREGATE step, as in:

> AGGREGATE File= * mode=addvariables
/Break= Group
>  /Mean= MEAN(English)
>  /SD=   SD(English)
>  /Min=  MIN(English)
>  /Max=  MAX(English) .

But now that you *did* use MATCH: I didn't know one could use the keyword ALL as BY variables. Does that mean "all vars of the smallest (breadthwise) file"?

Cheers!!
Albert-Jan

--- On Wed, 10/22/08, Dennis Deck <[hidden email]> wrote:

> From: Dennis Deck <[hidden email]>
> Subject: Re: syntax to compute a variable
> To: [hidden email]
> Date: Wednesday, October 22, 2008, 6:33 AM
> One approach would be to use AGGREGATE to compute the group
> statistics.
> You implied that you only have one group you want
> statistics for but this could easily be extended to
> calculate statistics for multiple subgroups.
>
> * define dummy break variable .
> COMPUTE Group = 1 .
>
> * compute statistics .
> DATASET DECLARE Means .
> AGGREGATE File= * /Break= Group
>  /Mean= MEAN(English)
>  /SD=   SD(English)
>  /Min=  MIN(English)
>  /Max=  MAX(English) .
>
> * merge with statistics .
> MATCH FILES
>   File=*
>  /Table= Means
>    /by= All .
>
>
>
> Dennis Deck, PhD
> RMC Research Corporation
> 111 SW Columbia Street, Suite 1200
> Portland, Oregon 97201-5843
> voice: 503-223-8248 x715
> voice: 800-788-1887 x715
> fax:  503-223-8399
> [hidden email]
>
> -----Original Message-----
> From: Johnny Amora [mailto:[hidden email]]
> Sent: Tuesday, October 21, 2008 8:11 PM
> Subject: syntax to compute a variable
>
> Hi all,
>
> Consider the syntax:
>
> DESCRIPTIVES
> VARIABLES=ENGLISH /SAVE
> /STATISTICS=MEAN STDDEV MIN MAX.
> Compute English_Tscore = 10*ZEnglish + 50.
> Execute.
>
> The first three lines invoke spss to add a ZENGLISH
> variable in the active dataset, then print the descriptive
> statistics of the ENGLISH variable.  What command is
> inserted so that my only output is the result of the compute
> command?  That is, the ZENGLISH will not appear on the
> active dataset and spss does not provide the descriptive
> statistics.  The only output is the English_Tscore added in
> the active data set.
>
> You may modify my syntax if you dont like as long as it
> generates the desired output.
>
> Thank you in advance.
>
> Johnny
>
>
>
>
>       New Email addresses available on Yahoo!
> Get the Email name you&#39;ve always wanted on the new
> @ymail and @rocketmail.
> Hurry before someone else does!
> http://mail.promotions.yahoo.com/newdomains/ph/
>
> =====================
> 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

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: syntax to compute a variable

Dennis Deck
Thanks.  I had not noticed the change in syntax over the years.
Got same suggestion from ViAnn

Oops.  The MATCH should include \By= Group rather than \By= All.  I had
started to use variable name "All" in the example but switched to
"Group" to reduce confusion.

Dennis

-----Original Message-----
From: Albert-jan Roskam [mailto:[hidden email]]
Sent: Wednesday, October 22, 2008 1:13 PM
To: [hidden email]; Dennis Deck
Subject: Re: syntax to compute a variable

Hi,

One remark and one question:
You might be able to skip the MATCH step by using MODE=ADDVARIABLES in
the AGGREGATE step, as in:

> AGGREGATE File= * mode=addvariables
/Break= Group
>  /Mean= MEAN(English)
>  /SD=   SD(English)
>  /Min=  MIN(English)
>  /Max=  MAX(English) .

But now that you *did* use MATCH: I didn't know one could use the
keyword ALL as BY variables. Does that mean "all vars of the smallest
(breadthwise) file"?

Cheers!!
Albert-Jan

--- On Wed, 10/22/08, Dennis Deck <[hidden email]> wrote:

> From: Dennis Deck <[hidden email]>
> Subject: Re: syntax to compute a variable
> To: [hidden email]
> Date: Wednesday, October 22, 2008, 6:33 AM
> One approach would be to use AGGREGATE to compute the group
> statistics.
> You implied that you only have one group you want
> statistics for but this could easily be extended to
> calculate statistics for multiple subgroups.
>
> * define dummy break variable .
> COMPUTE Group = 1 .
>
> * compute statistics .
> DATASET DECLARE Means .
> AGGREGATE File= * /Break= Group
>  /Mean= MEAN(English)
>  /SD=   SD(English)
>  /Min=  MIN(English)
>  /Max=  MAX(English) .
>
> * merge with statistics .
> MATCH FILES
>   File=*
>  /Table= Means
>    /by= All .
>
>
>
> Dennis Deck, PhD
> RMC Research Corporation
> 111 SW Columbia Street, Suite 1200
> Portland, Oregon 97201-5843
> voice: 503-223-8248 x715
> voice: 800-788-1887 x715
> fax:  503-223-8399
> [hidden email]
>
> -----Original Message-----
> From: Johnny Amora [mailto:[hidden email]]
> Sent: Tuesday, October 21, 2008 8:11 PM
> Subject: syntax to compute a variable
>
> Hi all,
>
> Consider the syntax:
>
> DESCRIPTIVES
> VARIABLES=ENGLISH /SAVE
> /STATISTICS=MEAN STDDEV MIN MAX.
> Compute English_Tscore = 10*ZEnglish + 50.
> Execute.
>
> The first three lines invoke spss to add a ZENGLISH
> variable in the active dataset, then print the descriptive
> statistics of the ENGLISH variable.  What command is
> inserted so that my only output is the result of the compute
> command?  That is, the ZENGLISH will not appear on the
> active dataset and spss does not provide the descriptive
> statistics.  The only output is the English_Tscore added in
> the active data set.
>
> You may modify my syntax if you dont like as long as it
> generates the desired output.
>
> Thank you in advance.
>
> Johnny
>
>
>
>
>       New Email addresses available on Yahoo!
> Get the Email name you&#39;ve always wanted on the new
> @ymail and @rocketmail.
> Hurry before someone else does!
> http://mail.promotions.yahoo.com/newdomains/ph/
>
> =====================
> 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

=====================
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