SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
Expand all | Collapse all

I want to know how I can import my CSV file into SPSS, without losing some of my text data

  • 1.  I want to know how I can import my CSV file into SPSS, without losing some of my text data

    Posted Mon October 05, 2020 12:07 PM

    When I import my CSV file, I lose the data for a few variables. This happens with the text data where I only have data for a few of the cases. I have a dataset with over 300 cases and I think this only happens with the variables for which I have data for less then 5% of the cases.

    The problem is that the text variables are converted into Numeric variables after importing it into SPSS. Thereby, all the data is lost for this variable.

    The dataset I work with has 1200 variables, so it is a lot of work to check or change all variables one by one.

    Does anyone know how I can prevent this?

    Thank you!






    #SPSSStatistics
    #Support
    #SupportMigration


  • 2.  RE: I want to know how I can import my CSV file into SPSS, without losing some of my text data
    Best Answer

    Posted Mon October 05, 2020 12:14 PM

    I already tried changing the variable into text in the CSV file and I tried to change type of the variable from numeric into string in the SPSS file, but both didn't work.

    When importing the CSV file there is a option in the Text Wizard to specify the data format for each variable. This seems to work but is a lot of work for 1200 variables.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 3.  RE: I want to know how I can import my CSV file into SPSS, without losing some of my text data
    Best Answer

    Posted Mon October 05, 2020 07:05 PM

    In the Text Wizard, go to the "Advanced" section. Leave the formats as AUTO and Paste the syntax. Then use the Edit > Replace function to change AUTO to, say, F8.2 for all the variables (hoping AUTO doesn't match part of a name. The exact F format choice doesn't matter. Then run that syntax.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 4.  RE: I want to know how I can import my CSV file into SPSS, without losing some of my text data
    Best Answer

    Posted Mon October 05, 2020 07:07 PM

    Meant to add, this assumes that variables names appear at the start of the file.






    #SPSSStatistics
    #Support
    #SupportMigration


  • 5.  RE: I want to know how I can import my CSV file into SPSS, without losing some of my text data
    Best Answer

    Posted Tue October 06, 2020 07:28 AM

    Thank you very much! Unfortunately not all my variables are numeric or string so I couldn't use the 'Replace' function. I didn't think of the option to paste and edit the format of the variables in the syntax. This helped me a lot because I can now look for the variables easily and adjust the format when necessary. Thanks again!






    #SPSSStatistics
    #Support
    #SupportMigration