This might be a trivial problem, but I’m stuck. Two variables, one a string variable containing county names and the other numeric codes for each
of the counties. I would like to assign value labels to the numeric codes using the text from the string variable. The plan was to extract a list of all combinations of the two and use this list in a “VALUE LABELS…” sequence. I don’t need to know how many
of each combination there are, I just need the actual combinations. SUMMARIZE don’t seem to work because there are no statistics involved. Any suggestions? Or possibly workarounds: is it possible to assign text in one variable to value labels in a numeric
variable in some better way than to edit a VALUE LABELS sequence? Robert
Robert Lundqvist
|
Administrator
|
Unless it is essential to retain the original numeric codes for countries for some reason, I would use AUTORECODE on the string variable to generate a numeric variable with country names as value labels.
--
Bruce Weaver bweaver@lakeheadu.ca http://sites.google.com/a/lakeheadu.ca/bweaver/ "When all else fails, RTFM." PLEASE NOTE THE FOLLOWING: 1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above. 2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/). |
In reply to this post by Robert L
A similar problem was discussed in 2014:
http://spssx-discussion.1045642.n5.nabble.com/value-labels-from-string-vars-tp5723809.html |
In reply to this post by Robert L
The STATS VALLBLS FROMDATA extension command might be applicable here. Some extracts from the syntax help. Create value labels for a set of variables using values of other variables for the labels. It also checks for conflicts and duplicate labels. It generates a syntax file of VALUE LABEL commands. STATS VALLBLS FROMDATA VARIABLES = variables or VARPATTERN = “regular expression” LBLVARS = string variables or LBLPATTERN = “regular expression” Example: STATS VALLBLS FROMDATA VARIABLES = x1 TO x5
LBLVARS = label. This command creates value labels for a set of variables using values of other variables for the labels. If x is a variable having values 1,2,3 and xlabel is a variable having values 'a', 'b', 'c', value labels for x are created as
VARIABLES lists the variables for which value labels should be produced. TO is supported, but ALL would not make sense here. VARPATTERN is a regular expression in quotes that maps to the variables to be labelled. Specify either VARIABLES or VARPATTERN but not both. See below for some pattern examples. LBLVARS lists the variables containing the labels corresponding to the variables to be labelled. TO is supported but ALL would not make sense. Numeric variables are automatically excluded. LBLPATTERN lists a regular expression in quotes that expands to the list of label variables. Numeric variables are automatically excluded. The number of label variables can be one to apply the same set of labels to all the selected variables or as many as there are input variables. If a label variable value is blank, no value label is generated from it. On Mon, Jun 27, 2016 at 3:08 AM, Robert Lundqvist <[hidden email]> wrote:
|
In reply to this post by Robert L
This is a pretty easy way to address this problem Rob…. *********this writes a label file syntax*******. write outfile = 'Y:\Location\label_1.sps' /"add value labels NameSuffixType " NameSuffixType " " NameSuffixTypeDesc ".". EXECUTE. ******This runs the label file syntax****. Insert file = 'Y:\Location\label_1.sps'. JT From: SPSSX(r) Discussion [mailto:[hidden email]]
On Behalf Of Robert Lundqvist This might be a trivial problem, but I’m stuck. Two variables, one a string variable containing county names and the other numeric codes for each of the counties.
I would like to assign value labels to the numeric codes using the text from the string variable. The plan was to extract a list of all combinations of the two and use this list in a “VALUE LABELS…” sequence. I don’t need to know how many of each combination
there are, I just need the actual combinations. SUMMARIZE don’t seem to work because there are no statistics involved. Any suggestions? Or possibly workarounds: is it possible to assign text in one variable to value labels in a numeric variable in some better
way than to edit a VALUE LABELS sequence? Robert ===================== To manage your subscription to SPSSX-L, send a message to
[hidden email] (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
|
Free forum by Nabble | Edit this page |