LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (December 2008)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 10 Dec 2008 16:09:34 -0600
Reply-To:     "Oliver, Richard" <roliver@spss.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Oliver, Richard" <roliver@spss.com>
Subject:      Re: auto creating labels
Comments: To: "Peck, Jon" <peck@spss.com>
In-Reply-To:  A<5CFEFDB5226CB54CBB4328B9563A12EE0A3B3361@hqemail2.spss.com>
Content-Type: text/plain; charset="US-ASCII"

There is a way to do this without resorting to Python, but it's arguably not as elegant as using Python. It involves using the WRITE command to generate a syntax file and then running the syntax file via INSERT, as in:

write outfile='/temp/tempfile.sps' / "add value labels v1 ", v1, " '", v2, "'.". execute. insert file= '/temp/tempfile.sps'.

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of Peck, Jon Sent: Wednesday, December 10, 2008 3:40 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: Re: auto creating labels

There is no built-in way to do this, but there is a function available in the spssaux2 module called genValueLabels that will do it. For example,

BEGIN PROGRAM. import spss, spssaux2

conflictKt = spssaux2.genValueLabels("V1", "V2") print conflictKt END PROGRAM.

This creates a value label set for V1 based on the associated V2 values (variable name case matters).

conflictKt is a count of the number of inconsistent pairs. So if you had V1 V2 1 biology 1 BIOLOGY

you would get a nonzero count.

This requires, of course, the Python plug-in and the spssaux2.py module downloadable from SPSS Developer Central (www.spss.com/devcentral).

HTH, Jon Peck

-----Original Message----- From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of David Wright Sent: Wednesday, December 10, 2008 2:24 PM To: SPSSX-L@LISTSERV.UGA.EDU Subject: [SPSSX-L] auto creating labels

Is there a way in syntax to create value labels by associating value indicators from one variable to labels in another?

For example, say I have two variables, V1 is the numeric code & V2 is the alpha value label.

V1 V2 23 biology 47 chemistry 13 anthropology

It would be nice to have syntax that would help produce:

val lab 23 'biology' 47 'chemistry' 13 'anthropology'

Perhaps if there was a way to push the above to output, don't know, I suspect I could aggregate on V1 in an output file & cut/paste with some inserts for formatting. Any ideas on automating this one?

Thanks in advance,

David

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

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


Back to: Top of message | Previous page | Main SPSSX-L page