Date: Tue, 30 Sep 2008 13:11:12 +0200
Reply-To: Staffan Lindberg <staffan.lindberg@anastat.se>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Staffan Lindberg <staffan.lindberg@anastat.se>
Subject: Using the variable names to select subsamples (Python help?)
Content-Type: text/plain; charset="us-ascii"
Dear list!
I have a large file in which the variable names signifies among other things
which cohort the subjects come from. This was done as follows (a few
examples):
1. The first character of the variable name (always alphabetical) signifies
which area within a large questionnaire the variable refers to, i.e.
A13AB (the first A means background variables/questions)
F130CDEF (the first F means drug abuse variables/questions)
2. The 2nd to at most 4th characters (always numerical) is the number of the
question within the area. Using the previous examples:
A13AB (13 means the 13th question among the background variables/questions)
F130CDEF (130 means the 130th questions among the drug abuse
variables/questions)
3. The rest of the variable name consists of allphabetical characters
specifying the cohort year. Using the same examples:
A13AB (AB at the end means that the variable/question is found in cohort
A=1985 and cohort B=1989)
F130CDEF (CDEF at the end means that te variable/question is found in cohort
C=1993 and cohort D=1997 and cohort E=2001 and cohort F=2005)
Now I want to use the variable names for making different kind of
selections, for example:
1. All variables for cohort F=2005
2. All variables that occur in both cohort A=1985 and cohort F=2005
3. All variables that occur in all cohorts (ABCDEF in the end of the
variable name)
4. All variables within area A and F
I suspect this demands a Python approach. Having just attended Ray's course
in Python I am still a beginner and have some difficulty in seeing the
forest because of all the trees. Perhaps a kind soul could help or point me
in the right direction?
best
Staffan Lindberg
Sweden
====================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
|