Search code examples
syntaxspss

track a syntax code in SPSS


I have an SPSS data base with seversl recoded variables. I would like to recheck the codes of these variables but I don't have the syntax code saved. Is there a way to track them?


Solution

  • While you might be able to figure out the reverse transformation (which might not be 1-1), you might be able to find the recode syntax that was used in the journal file on the system where the recoding was done. The syntax of course would also appear in the Viewer file of the session if you have that.

    The journal file, which is on by default, records all syntax that was run and continuously appends to that file. To find the journal, look at Edit > Options > Files.

    For the future, if you are using recodes to bin variables, look at the Visual Binner (Transform > Visual Binning). It has the option to make value labels for the output variables that show the input recode range for each value.

    There is also a Python module, Transform.py, available from the SPSS Community website (https://www.ibm.com/developerworks/community/files/app?lang=en#/file/4b37d86f-70fb-44e2-9896-ed4ff1cee1e7) that allows you to run common transformation commands such as COMPUTE, RECODE, and others from Python code while saving the actual Statistics syntax as a custom variable attribute that becomes a permanent part of the data file.