SPSS Statistics

 View Only
  • 1.  Variable names

    Posted Mon March 27, 2023 02:39 AM
    I have been sent 70 different SPSS files containing 1.5 million cases. The common identifier across each of these files is the ID so that they can be linked and merged. But not all cases appear in all files. The ID is made up of 1 to 34 symbols including periods and spaces. I could change all the variables in one file to create new variable names but how do I ensure that the change can be replicated in all the files so that they can be linked. Many thanks.

    Sent from my iPhone


  • 2.  RE: Variable names

    IBM Champion
    Posted Mon March 27, 2023 10:02 AM
    Assuming that you are adding cases rather than just adding variable, you can use the RENAME subcommand on the ADD FILES command to rename variables in each specific file.  If there is a pattern to the names across files, it might be possible to automate this renaming, but otherwise you would have to spell out the mapping. 

    ADD FILES allows up to 50 files to me merged in one command, so you would need to do two passes to get all 70 files together.

    Note that if there are string variables in the files, the lengths must be the same for each particular variable across the files.  If you have a lot of that to deal with, the STATS ADJUST WIDTHS extension command can fix that problem.

    --