Adding variables from several AGGREGATE calculations

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

Adding variables from several AGGREGATE calculations

Patricio Calderon-2
Hi,
I'm trying to add variables to the same output file.  The data source is the
same to all the aggregate variables.  However, I have not been able to
append the new variables; the AGGREGATE command keeps replacing the old
variable with the new variable.

Below is an example of the syntax:

/*Child Behavior.
COMPUTE filter_$=(IdFaspScaleLkup = 840).
VARIABLE LABEL filter_$ 'IdFaspScaleLkup = 840 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMAT filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

AGGREGATE
/OUTFILE='Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
/BREAK= NbrPersonIdNumber
/EARLIEST_CHILD_BEHAVIOR=MIN(  IdFaspRatingLkup)
/LATEST_CHILD_BEHAVIOR=MAX( IdFaspRatingLkup).

/*Child Development/Cognitive Skills.
COMPUTE filter_$=(IdFaspScaleLkup = 820).
VARIABLE LABEL filter_$ 'IdFaspScaleLkup = 820 (FILTER)'.
VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
FORMAT filter_$ (f1.0).
FILTER BY filter_$.
EXECUTE.

AGGREGATE
/OUTFILE='Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
/BREAK= NbrPersonIdNumber
/EARLIEST_DEV_COG_SKILLS=MIN(  IdFaspRatingLkup)
/LATEST_DEV_COG_SKILLS=MAX( IdFaspRatingLkup).

As you can see, the source variable (IdFaspRatingLkup) for the AGGREGATE
command is the same, therefore I created a new filter to select a new code
for each AGGREGATE command.

Any help would be immensely appreciated.

Patricio

=====================
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: Adding variables from several AGGREGATE calculations

Jerabek Jindrich
Hi Patricio,

You run aggregate twice and always the output file is the same "'Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
".

The second run rewrites the data saved in first run.

Specify two diferent output files to get two new datasets, one for IdFaspScaleLkup = 840 and another for IdFaspScaleLkup = 820.

HTH
jindra


> ------------ Původní zpráva ------------
> Od: Patricio Calderon <[hidden email]>
> Předmět: Adding variables from several AGGREGATE calculations
> Datum: 11.8.2010 22:16:44
> ----------------------------------------
> Hi,
> I'm trying to add variables to the same output file.  The data source is the
> same to all the aggregate variables.  However, I have not been able to
> append the new variables; the AGGREGATE command keeps replacing the old
> variable with the new variable.
>
> Below is an example of the syntax:
>
> /*Child Behavior.
> COMPUTE filter_$=(IdFaspScaleLkup = 840).
> VARIABLE LABEL filter_$ 'IdFaspScaleLkup = 840 (FILTER)'.
> VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
> FORMAT filter_$ (f1.0).
> FILTER BY filter_$.
> EXECUTE.
>
> AGGREGATE
> /OUTFILE='Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
> /BREAK= NbrPersonIdNumber
> /EARLIEST_CHILD_BEHAVIOR=MIN(  IdFaspRatingLkup)
> /LATEST_CHILD_BEHAVIOR=MAX( IdFaspRatingLkup).
>
> /*Child Development/Cognitive Skills.
> COMPUTE filter_$=(IdFaspScaleLkup = 820).
> VARIABLE LABEL filter_$ 'IdFaspScaleLkup = 820 (FILTER)'.
> VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
> FORMAT filter_$ (f1.0).
> FILTER BY filter_$.
> EXECUTE.
>
> AGGREGATE
> /OUTFILE='Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
> /BREAK= NbrPersonIdNumber
> /EARLIEST_DEV_COG_SKILLS=MIN(  IdFaspRatingLkup)
> /LATEST_DEV_COG_SKILLS=MAX( IdFaspRatingLkup).
>
> As you can see, the source variable (IdFaspRatingLkup) for the AGGREGATE
> command is the same, therefore I created a new filter to select a new code
> for each AGGREGATE command.
>
> Any help would be immensely appreciated.
>
> Patricio
>
> =====================
> 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: Adding variables from several AGGREGATE calculations

Ruben Geert van den Berg
Dear Patricio,
 
I agree with Jindra. An alternative way could be to use
 

AGGREGATE
/OUTFILE=* mode=addvariables

/BREAK= NbrPersonIdNumber
/EARLIEST_CHILD_BEHAVIOR=MIN( IdFaspRatingLkup)
/LATEST_CHILD_BEHAVIOR=MAX( IdFaspRatingLkup).

 
, change the filter, use [mode=addvariables] again and so on. I think the only remaining steps would be to 1) unduplicate your file and 2) save it. In this case you'll end up with a single aggregated file without having to merge a number of outfiles with [match files].
 
HTH,

Ruben van den Berg
Consultant Models & Methods
TNS NIPO
Email: [hidden email]
Mobiel: +31 6 24641435
Telefoon: +31 20 522 5738
Internet: www.tns-nipo.com



 

> Date: Thu, 12 Aug 2010 01:06:55 +0200
> From: [hidden email]
> Subject: Re: Adding variables from several AGGREGATE calculations
> To: [hidden email]
>
> Hi Patricio,
>
> You run aggregate twice and always the output file is the same "'Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
> ".
>
> The second run rewrites the data saved in first run.
>
> Specify two diferent output files to get two new datasets, one for IdFaspScaleLkup = 840 and another for IdFaspScaleLkup = 820.
>
> HTH
> jindra
>
>
> > ------------ Původní zpráva ------------
> > Od: Patricio Calderon <[hidden email]>
> > Předmět: Adding variables from several AGGREGATE calculations
> > Datum: 11.8.2010 22:16:44
> > ----------------------------------------
> > Hi,
> > I'm trying to add variables to the same output file. The data source is the
> > same to all the aggregate variables. However, I have not been able to
> > append the new variables; the AGGREGATE command keeps replacing the old
> > variable with the new variable.
> >
> > Below is an example of the syntax:
> >
> > /*Child Behavior.
> > COMPUTE filter_$=(IdFaspScaleLkup = 840).
> > VARIABLE LABEL filter_$ 'IdFaspScaleLkup = 840 (FILTER)'.
> > VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
> > FORMAT filter_$ (f1.0).
> > FILTER BY filter_$.
> > EXECUTE.
> >
> > AGGREGATE
> > /OUTFILE='Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
> > /BREAK= NbrPersonIdNumber
> > /EARLIEST_CHILD_BEHAVIOR=MIN( IdFaspRatingLkup)
> > /LATEST_CHILD_BEHAVIOR=MAX( IdFaspRatingLkup).
> >
> > /*Child Development/Cognitive Skills.
> > COMPUTE filter_$=(IdFaspScaleLkup = 820).
> > VARIABLE LABEL filter_$ 'IdFaspScaleLkup = 820 (FILTER)'.
> > VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
> > FORMAT filter_$ (f1.0).
> > FILTER BY filter_$.
> > EXECUTE.
> >
> > AGGREGATE
> > /OUTFILE='Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
> > /BREAK= NbrPersonIdNumber
> > /EARLIEST_DEV_COG_SKILLS=MIN( IdFaspRatingLkup)
> > /LATEST_DEV_COG_SKILLS=MAX( IdFaspRatingLkup).
> >
> > As you can see, the source variable (IdFaspRatingLkup) for the AGGREGATE
> > command is the same, therefore I created a new filter to select a new code
> > for each AGGREGATE command.
> >
> > Any help would be immensely appreciated.
> >
> > Patricio
> >
> > =====================
> > 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: Adding variables from several AGGREGATE calculations

Patricio Calderon-2
In reply to this post by Jerabek Jindrich
Thank you Jerabek for your help, however, I want to specify one new dataset.  That is, I would like to have those results to converge into one dataset, not two.

Thanks,
Patricio

2010/8/11 Jerabek Jindrich <[hidden email]>
Hi Patricio,

You run aggregate twice and always the output file is the same "'Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
".

The second run rewrites the data saved in first run.

Specify two diferent output files to get two new datasets, one for IdFaspScaleLkup = 840 and another for IdFaspScaleLkup = 820.

HTH
jindra


> ------------ Původní zpráva ------------
> Od: Patricio Calderon <[hidden email]>
> Předmět: Adding variables from several AGGREGATE calculations
> Datum: 11.8.2010 22:16:44
> ----------------------------------------
> Hi,
> I'm trying to add variables to the same output file.  The data source is the
> same to all the aggregate variables.  However, I have not been able to
> append the new variables; the AGGREGATE command keeps replacing the old
> variable with the new variable.
>
> Below is an example of the syntax:
>
> /*Child Behavior.
> COMPUTE filter_$=(IdFaspScaleLkup = 840).
> VARIABLE LABEL filter_$ 'IdFaspScaleLkup = 840 (FILTER)'.
> VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
> FORMAT filter_$ (f1.0).
> FILTER BY filter_$.
> EXECUTE.
>
> AGGREGATE
> /OUTFILE='Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
> /BREAK= NbrPersonIdNumber
> /EARLIEST_CHILD_BEHAVIOR=MIN(  IdFaspRatingLkup)
> /LATEST_CHILD_BEHAVIOR=MAX( IdFaspRatingLkup).
>
> /*Child Development/Cognitive Skills.
> COMPUTE filter_$=(IdFaspScaleLkup = 820).
> VARIABLE LABEL filter_$ 'IdFaspScaleLkup = 820 (FILTER)'.
> VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
> FORMAT filter_$ (f1.0).
> FILTER BY filter_$.
> EXECUTE.
>
> AGGREGATE
> /OUTFILE='Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
> /BREAK= NbrPersonIdNumber
> /EARLIEST_DEV_COG_SKILLS=MIN(  IdFaspRatingLkup)
> /LATEST_DEV_COG_SKILLS=MAX( IdFaspRatingLkup).
>
> As you can see, the source variable (IdFaspRatingLkup) for the AGGREGATE
> command is the same, therefore I created a new filter to select a new code
> for each AGGREGATE command.
>
> Any help would be immensely appreciated.
>
> Patricio
>
> =====================
> 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: Adding variables from several AGGREGATE calculations

Bruce Weaver
Administrator
Have you seen Ruben's post?  He suggested something like this (untested):

COMPUTE f840 = (IdFaspScaleLkup EQ 840). /* child behavior .
COMPUTE f820 = (IdFaspScaleLkup EQ 820). /* child development/cognitive skills .
exe.

use all.
filter by f840.

AGGREGATE
 /OUTFILE=* mode=addvariables
 /BREAK= NbrPersonIdNumber
 /EARLIEST_CHILD_BEHAVIOR=MIN( IdFaspRatingLkup)
 /LATEST_CHILD_BEHAVIOR=MAX( IdFaspRatingLkup).

use all.
filter by f820.

AGGREGATE
 /OUTFILE=* mode=addvariables
 /BREAK= NbrPersonIdNumber
 /EARLIEST_DEV_COG_SKILLS=MIN(  IdFaspRatingLkup)
 /LATEST_DEV_COG_SKILLS=MAX( IdFaspRatingLkup).

use all.
filter off.



Patricio Calderon-2 wrote
Thank you Jerabek for your help, however, I want to specify one new
dataset.  That is, I would like to have those results to converge into one
dataset, not two.

Thanks,
Patricio

2010/8/11 Jerabek Jindrich <JindraJerabek@seznam.cz>

> Hi Patricio,
>
> You run aggregate twice and always the output file is the same
> "'Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
> ".
>
> The second run rewrites the data saved in first run.
>
> Specify two diferent output files to get two new datasets, one for
> IdFaspScaleLkup = 840 and another for IdFaspScaleLkup = 820.
>
> HTH
> jindra
>
>
> > ------------ Původní zpráva ------------
> > Od: Patricio Calderon <patricios1@GMAIL.COM>
> > Předmět: Adding variables from several AGGREGATE calculations
> > Datum: 11.8.2010 22:16:44
> > ----------------------------------------
> > Hi,
> > I'm trying to add variables to the same output file.  The data source is
> the
> > same to all the aggregate variables.  However, I have not been able to
> > append the new variables; the AGGREGATE command keeps replacing the old
> > variable with the new variable.
> >
> > Below is an example of the syntax:
> >
> > /*Child Behavior.
> > COMPUTE filter_$=(IdFaspScaleLkup = 840).
> > VARIABLE LABEL filter_$ 'IdFaspScaleLkup = 840 (FILTER)'.
> > VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
> > FORMAT filter_$ (f1.0).
> > FILTER BY filter_$.
> > EXECUTE.
> >
> > AGGREGATE
> > /OUTFILE='Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
> > /BREAK= NbrPersonIdNumber
> > /EARLIEST_CHILD_BEHAVIOR=MIN(  IdFaspRatingLkup)
> > /LATEST_CHILD_BEHAVIOR=MAX( IdFaspRatingLkup).
> >
> > /*Child Development/Cognitive Skills.
> > COMPUTE filter_$=(IdFaspScaleLkup = 820).
> > VARIABLE LABEL filter_$ 'IdFaspScaleLkup = 820 (FILTER)'.
> > VALUE LABELS filter_$ 0 'Not Selected' 1 'Selected'.
> > FORMAT filter_$ (f1.0).
> > FILTER BY filter_$.
> > EXECUTE.
> >
> > AGGREGATE
> > /OUTFILE='Z:\Research\TD\TEST FASP RATINGS SYNTAX4.SAV'
> > /BREAK= NbrPersonIdNumber
> > /EARLIEST_DEV_COG_SKILLS=MIN(  IdFaspRatingLkup)
> > /LATEST_DEV_COG_SKILLS=MAX( IdFaspRatingLkup).
> >
> > As you can see, the source variable (IdFaspRatingLkup) for the AGGREGATE
> > command is the same, therefore I created a new filter to select a new
> code
> > for each AGGREGATE command.
> >
> > Any help would be immensely appreciated.
> >
> > Patricio
> >
> > =====================
> > To manage your subscription to SPSSX-L, send a message to
> > LISTSERV@LISTSERV.UGA.EDU (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
> >
> >
> >
>
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).