Discussion:
Concatenating columns in SPSS
(too old to reply)
Simmers
2019-04-26 09:29:21 UTC
Permalink
Hello helpful people,

I am trying to merge data from two columns in SPSS to create new column of data with both pieces of data in. The two columns that I want to combine are a unique pupil identifier (UPID) and an academic year (AY). The dataset currently has several rows per subject, based on how many academic years of data have been collected, so I want to combine the UPID with AY to create a column of unique reference numbers that will give me a single row per pupil format.

Hope that makes sense, and is possible!

Thanks in advance, S
Bruce Weaver
2019-04-26 13:36:24 UTC
Permalink
Post by Simmers
Hello helpful people,
I am trying to merge data from two columns in SPSS to create new column of data with both pieces of data in. The two columns that I want to combine are a unique pupil identifier (UPID) and an academic year (AY). The dataset currently has several rows per subject, based on how many academic years of data have been collected, so I want to combine the UPID with AY to create a column of unique reference numbers that will give me a single row per pupil format.
Hope that makes sense, and is possible!
Thanks in advance, S
What types of variables are they? Please provide a few rows of sample data to illustrate?
Rich Ulrich
2019-04-26 16:19:06 UTC
Permalink
On Fri, 26 Apr 2019 02:29:21 -0700 (PDT), Simmers
Post by Simmers
Hello helpful people,
I am trying to merge data from two columns in SPSS to create new column of data with both pieces of data in. The two columns that I want to combine are a unique pupil identifier (UPID) and an academic year (AY). The dataset currently has several rows per subject, based on how many academic years of data have been collected, so I want to combine the UPID with AY to create a column of unique reference numbers that will give me a single row per pupil format.
Hope that makes sense, and is possible!
Thanks in advance, S
No, it does not make sense. The first request is to combine
two alpha or numeric values into one; the end of the message
asks for "a single row per pupil format" - in contrast to "a
unique, single-variable identifier per row."

You get a single row per pupil by uses CasesToVars.

You get a single, combined ID by various means. The simplest
is possible when both are numeric and fixed length. For
instance, if the AY is a single digit, you could create your
new ID by
Compute UPIDyr= 10*UPID + AY.

To combine to Strings, use CONCAT.

A String result from mixed formats is more complicated. I find an
example at
https://www.ibm.com/support/knowledgecenter/en/SSLVMB_24.0.0/spss/base/syn_transformation_expressions_conversion_functions.html
--
Rich Ulrich
David Marso
2019-04-26 19:25:30 UTC
Permalink
Please provide example of data.
Meanwhile see CONCAT,STRING and NUMBER functions and CASESTOVARS.
Loading...