Date: Thu, 9 Sep 2010 17:05:09 -0700
Reply-To: Mike Pritchard <5circles@gmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Mike Pritchard <5circles@gmail.com>
Organization: 5 Circles Research
Subject: Update on Syntax extraction
In-Reply-To: <008DD9CD8C084CB49533C1522A0770AD@ssw.buffalo.edu>
Content-Type: text/plain; charset="us-ascii"
Thanks to Gene, Art, and Bruce for suggestions. I'm not sure that I
understood everything suggested (some ideas seemed to need me to get up to
speed on some deeper aspects of SPSS syntax), but I wanted to give a quick
update on the eventual resolution.
I changed all the source variables to string type. Then ran a piece of
syntax that had earlier caused problems because of the different variable
types. I still wish there was an easy way to detect the variable type in
syntax (I'm using V16).
The eventual code looks like this - including the punch of the top option
chosen. I'm sure it could be more elegant/efficient, but it worked.
DELETE VARIABLES Q4aCategory_Top.
STRING Q4aCategory_Top (A250).
COMPUTE Q4aCategory_Top = Q4aCategory.
EXECUTE.
ALTER TYPE Q4aCategory_Top (F5.0).
DO IF (CHAR.LENGTH(Q4aCategory)>2).
COMPUTE Q4aCategory_Top = 97.
END IF.
EXECUTE.
COUNT #temp = Q4Category_1 Q4Category_2 Q4Category_3 Q4Category_4
Q4Category_5 Q4Category_6 Q4Category_7 Q4Category_8 Q4Category_9
Q4Category_10 Q4Category_97 (1).
DO IF (#temp=1).
IF (Q4Category_1=1) Q4aCategory_Top=1.
IF (Q4Category_2=1) Q4aCategory_Top=2.
IF (Q4Category_3=1) Q4aCategory_Top=3.
IF (Q4Category_4=1) Q4aCategory_Top=4.
IF (Q4Category_5=1) Q4aCategory_Top=5.
IF (Q4Category_6=1) Q4aCategory_Top=6.
IF (Q4Category_7=1) Q4aCategory_Top=7.
IF (Q4Category_8=1) Q4aCategory_Top=8.
IF (Q4Category_9=1) Q4aCategory_Top=9.
IF (Q4Category_10=1) Q4aCategory_Top=10.
IF (Q4Category_97=1) Q4aCategory_Top=97.
END IF.
EXECUTE.
The test with CHAR.LENGTH is a feeble attempt to create a code for text in
the original variable. It worked, but only because respondents who entered
text used more than 2 characters - the maximum for the original codes.
There was one variable that still caused problems because all cases passed
this test. I wasn't able to see what the issue was caused by, but when I
cleared the contents (they already looked clear to me) the syntax worked.
Thanks again!
Mike
=====================
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