SPSS Statistics

SPSS Statistics

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

 View Only
  • 1.  Is there a way of tidying up this horrific txt file?

    Posted Wed September 27, 2023 11:06 AM
      |   view attached

    Hi there,

    I'm a newbie to SPSS so am not sure whether the following is possible, or whether it will be a painstaking Excel job... I want to analyse this dataset which comes in a .txt file. However, upon closer inspection the formatting is horrible: each line contains more or less variables, with omitted variable names so that the columns don't line up when you try to import the data into SPSS (see screenshot).

    Is there a way that I can shift certain values across to the right (from data view perspective) to line up all the addresses, all the postal codes, all the country lines etc.? Any ideas would be appreciated! Thanks



    ------------------------------
    Seb Rumsby
    ------------------------------


  • 2.  RE: Is there a way of tidying up this horrific txt file?

    Posted Wed September 27, 2023 12:02 PM
    It's a little hard to tell, since the text has been mangled by passing it into SPSS in the wrong format, but I suspect that this text is actually in JSON format.  So it would need to be converted to CSV or similar before importing it into SPSS (or Excel)

    Can you post a sample of the file or at least an image before the import attempt?

    --





  • 3.  RE: Is there a way of tidying up this horrific txt file?

    Posted Thu September 28, 2023 09:28 PM

    I think my reply this morning didn't go through ...

    Yes, that looks like a JSON-format file, where items appear as key-value pairs.   Try running it through a JSON-to-CSV converter and then importing it.  I haven't used any of these, but here is one where you just upload the file, press the convert button, and download the resulting csv file.


    ------------------------------
    Jon Peck
    ------------------------------