SPSS Statistics

 View Only
  • 1.  Combining data from 5 columns into one column

    Posted Thu April 18, 2024 10:08 AM

    What is the best way to combine data from 5 columns into just one column? Of the 5 columns, only one has data in it, so there's only one response per person to aggregate into one column. I thought I could code the string variables into numbers and then add them in a separate column, but that isn't working. Any thoughts? I have mostly string data but will code them into numbers, so I can try it with either type of data. When I code them into numbers I get an unfamilar message that says "Warning: String variables being recoded differ in length. The recode may be inappropriate for some variables," but it looks like it recodes just fine. I'm recoding a Likert scale like I always do, so it seems like it came out of Survey Monkey a bit wonky. Thanks for any ideas you have! I thought this would be easy.



    ------------------------------
    Mindy Burch
    ------------------------------


  • 2.  RE: Combining data from 5 columns into one column

    Posted Thu April 18, 2024 10:57 AM

    You may want to use the recode method to recode your Likert scales to numbers -- do you mean "5-Very high" when you refer to the survey results? If so, you can also just strip out the first character and recode it to a number.

    Just check the bottom of the recode pop up screen to make sure that you are giving the new variable enough characters -- if you are recoding to 100 as your top rank, for example, make sure your new variable length is set to 3.



    ------------------------------
    Marianne Pelletier
    ------------------------------



  • 3.  RE: Combining data from 5 columns into one column

    Posted Thu April 18, 2024 03:16 PM

    Thank you for your response. The variable widths all differ but the smallest is 5 and the new codes are single digits, so that should be fine. I had tried increasing the width, columns, and alignment but that didn't work. 



    ------------------------------
    Mindy Burch
    ------------------------------



  • 4.  RE: Combining data from 5 columns into one column

    IBM Champion
    Posted Thu April 18, 2024 12:51 PM
    No need to change  the types.  Run this code with appropriate variable names.  It assumes variables a to e are contiguous.  Otherwise spell them out.

    missing values a to e ("").
    string z (a10).
    compute z = max(a to e).

    --





  • 5.  RE: Combining data from 5 columns into one column

    Posted Thu April 18, 2024 03:38 PM

    Hi Jon, thanks for your reply. I tried your method in syntax with several different sets of variables and one of them created a Z column but the others just gave a variety of error messages. I must be missing something. 



    ------------------------------
    Mindy Burch
    ------------------------------



  • 6.  RE: Combining data from 5 columns into one column

    IBM Champion
    Posted Thu April 18, 2024 03:40 PM
    I would have to see your syntax and the error messages.

    --





  • 7.  RE: Combining data from 5 columns into one column

    Posted Thu April 18, 2024 02:37 PM

    VARSTOCASES would also work



    ------------------------------
    Art Jack
    ------------------------------



  • 8.  RE: Combining data from 5 columns into one column

    Posted Thu April 18, 2024 03:38 PM

    I'm not familiar with that, can you tell me a little more about how to use it? Thanks! 



    ------------------------------
    Mindy Burch
    ------------------------------



  • 9.  RE: Combining data from 5 columns into one column

    Posted Mon April 22, 2024 08:54 AM

    The spss tools site has some examples.

    https://www.spsstools.net/en/syntax/syntax-index/restructure-file/varstocases-and-casestovars/



    ------------------------------
    Art Jack
    ------------------------------