Date: Wed, 31 Dec 2008 10:56:08 -0500
Reply-To: Gene Maguin <emaguin@buffalo.edu>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Gene Maguin <emaguin@buffalo.edu>
Subject: Re: cases to vars
In-Reply-To: <957374.28001.qm@web110704.mail.gq1.yahoo.com>
Content-Type: text/plain; charset="iso-8859-1"
Keval,
Maybe I am missing something but I can't see how one of your syntax
statements will work correctly given the prior statement. See below for
details.
In response to your specific question, I don't think there is an syntax
solution for this. (I suspect that using either script or python you could
inspect the dictionary and count the number of times 'association' is
listed. I can't do this. Somebody else can comment.) Instead, I think you
have to determine this number interactively. That said, there are a number
of methods for doing so. A frequencies of ID will show the number of records
for each id. You could aggregate by id to get a case count that is added to
the current dataset (mode=addvariables) and do a frequencies on that
variable. After the casestovars is completed, you can look at the dictionary
and see how many association variables there are. Lastly, I think the
Casestovars command may report something about this but I am not sure. Once
you know that number, you could use the Numeric command to create additional
variables so that your rename and select if statements are constants.
(Again, I'll bet that either script or python could be used to 'fix up'
dataset after the casestovars to have a constant number of association
variables. However, you still have the problem of deciding on a max number.
Again, somebody that knows script or python can comment.)
Gene Maguin
ID ASSOCIATION
1 Basketball
1 Soccer
When i use the cases to vars procedure I get the outut below:
casestovars /id = id/groupby = variable.
ID Association.1 Association.2
1 Basketball Soccer
I then use the following syntax:
rename variables (asssociation.1 = sport1) (association.2 = sport2)
select if (any(association.1, 'Basketball', 'Soccer', 'Golf', 'Lacrosse',
'Softball', 'Volleyball', 'Tennis') |
any(association.2, 'Basketball', 'Soccer', 'Golf', 'Lacrosse', 'Softball',
'Volleyball', 'Tennis')).
**** This is the problem. Following the rename command, the variables
Association.1 and Association.2 no longer exist. So, the select if statement
should be giving an error. By the way, why not so the rename prior to the
casestovars.
I am running a syntax file for different school terms and in some term the
number of associations may be greater than 2.
Is there any way I can adjust the syntax (specifically, the rename and
select statements) to take into account how many associations there are?
Thanks,
Keval
=======
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
=====================
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
|