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 14:24:18 -0800
Reply-To:     "Conlon, Dan (DSHS/HRSA)" <CONLODR@dshs.wa.gov>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         "Conlon, Dan (DSHS/HRSA)" <CONLODR@dshs.wa.gov>
Subject:      Re: auto creating labels
In-Reply-To:  <20081210170239.V0OM6.10689.imail@eastrmwml38>
Content-Type: text/plain; charset=us-ascii

Here's a solution I used a couple times pre-Python days that I think does what you're looking for (if I understand what you're trying to do correctly). It came from SPSS Support a few years ago.

Resolution number: 31573 Created on: Feb 24 2003 Last Reviewed on: Dec 26 2007

Problem Subject: Creating value labels from the values of a separate variable in SPSS

Problem Description: I am using SPSS for Windows and I would like to automatically create value labels for one variable from the values of another variables. How can I do this?

Resolution Subject: The following syntax commands will produce value labels from your file data

Resolution Description: Below is some syntax that will show you how to do this. The syntax will create a sample data file and apply the values of v2 as value labels of v1.

*This will create a sample data set. *The data set needs to be aggregated down so there is a 1-1 relationship between value and value label.

DATA LIST FREE /v1 (F1) v2 (A1). BEGIN DATA 1 a 2 b 3 c 4 d 5 e END DATA.

/*This section will write out the words value labels and the variable name in the valuelabel.dat file.*/ DO IF ($casenum=1). WRITE OUTFILE = 'c:\temp\valuelabel.dat'/ 'VALUE LABELS v1'. END IF.

/*This section will write out the values and value labels in the valuelabel.dat file.*/ WRITE OUTFILE = 'c:\temp\valuelabel.dat'/ ' ' v1 " '" v2 "' ". EXECUTE.

INCLUDE 'c:\temp\valuelabel.dat'.

Dan

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

Hector,

Yes, this is the method I do now. Unfortunately, I get several of these types of data. Jon, as you did, suggested the pyhton route but I would like to avoid it. I recently sent a reply ViAnn concerning perhaps another option, the code would perhaps be a bear but once set I could use, just not sure it would work.

I was thinking after addressing her question that perhaps I could aggregate an output on the numeric bringing over the alpha label, create a new string by concatenating the altered numeric & label (also creatinga string for the apostrohpe), then I could cut & paste from the aggregated data editor into the syntax file.

What do you think?

DW

---- Hector Maletta <hmaletta@fibertel.com.ar> wrote: > It is surely programmable with Python in a very elegant way. A more > primitive approach is producing the list of values both variables (e.g. by > ordering a frequencies Table), make sure each numeric code in V1 corresponds > to the alphabetic code in V2, then copy-paste the results to Excel, delete > the frequencies and percentage columns, insert two narrow columns for the > apostrophes, et voila: just add the command at the begginning (VALUE LABEL > V1) and a period at the end. > As I do not face this kind of problem often, I thought it was not worthwhile > to trouble myself programming it: this quick and dirty copy-paste solution I > find fast enough. At least in my "Keep it simple" mentality. > Hector > > > -----Original Message----- > From: SPSSX(r) Discussion [mailto:SPSSX-L@LISTSERV.UGA.EDU] On Behalf Of > David Wright > Sent: 10 December 2008 19:24 > To: SPSSX-L@LISTSERV.UGA.EDU > Subject: 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

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