SPSS Statistics

 View Only
  • 1.  Restructuring and Aggregating Data

    Posted Mon January 23, 2023 11:15 AM

    Hello!

    I am attempting to restructure and then aggregate data in SPSS. Although I do know how to restructure the data, I am stuck on one part.

    Some of my data have multiple names in the variable that I am restructuring based on. For example, I am restructuring based on school name; however, some of my observations have multiple school names under one variable (e.g., instead of Minneapolis Middle School, it has Minneapolis Middle School, St. Paul High School, University of Minnesota). What I would like to do is to divide those observations into separate observations. So, if there were 3 schools listed, I would create 3 duplicates of the original observation, keeping all other original variables with the duplicates.

    Any thoughts or help is much appreciated!



    ------------------------------
    Gretchen Baas
    ------------------------------


  • 2.  RE: Restructuring and Aggregating Data

    Posted Mon January 23, 2023 01:41 PM
    Edited by Art Jack Mon January 23, 2023 02:01 PM
    Can you paste a small example of how your data looks & how you want it to be in the end?  

    I'm assuming you have multiple records per site.

    I'd probably do something like this.

    file handle temp /name='c:\data
    file handle temp1 /name='c:\et

    dataset close all.
    get file='temp/data.sav'.
    select if char.index(lower(school), 'minneapolis' )>0.
    save outfile='temp1/temp1.sav' /keep school observations. ((/rename if different)))

    dataset close all.
    get file='temp/data.sav'.
    select if char.index(lower(school), 'paul' )>0.
    save outfile='temp1/temp2.sav' /keep school observations. ((/rename if different)))

    dataset close all.
    add files /file='temp1/temp1.sav'
    /file='temp1/temp2.sav' .
    execute.


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



  • 3.  RE: Restructuring and Aggregating Data

    Posted Mon January 30, 2023 04:19 PM
    Could I get a representative sample of those data so I could see a little better what you have? Thanks.

    marcantr@us.ibm.com

    ------------------------------
    Rick Marcantonio
    Quality Assurance
    IBM
    ------------------------------