How can I loop through variables in SPSS? I want to avoid code duplication.

Posted by chucknelson on Stack Overflow See other posts from Stack Overflow or by chucknelson
Published on 2010-05-21T18:12:54Z Indexed on 2010/05/21 18:20 UTC
Read the original article Hit count: 365

Filed under:
|
|

Is there a "native" SPSS way to loop through some variable names? All I want to do is take a list of variables (that I define) and run the same procedure for them:

pseudo-code - not really a good example, but gets the point across...

for i in varlist['a','b','c']
do
  FREQUENCIES VARIABLES=varlist[i] / ORDER=ANALYSIS.
end

I've noticed that people seem to just use R or Python SPSS plugins to achieve this basic array functionality, but I don't know how soon I can get those configured (if ever) on my installation of SPSS.

SPSS has to have some native way to do this...right?

© Stack Overflow or respective owner

Related posts about spss

  • Re-using SPSS 18 Trial in OSX?

    as seen on Super User - Search for 'Super User'
    A friend of mine needs to use SPSS for a project she is working on, and would normally have access to it in her school's library. Unfortunately she's out of town for the next couple weeks, and she's already gone through the trial version once. Is there some way she would be able to re-use the trial… >>> More

  • 2 spss and mrInterview template questions

    as seen on Stack Overflow - Search for 'Stack Overflow'
    How can I align the mrProgress bar to be the same size as the image at the top of the table? (I'd like it below the image.) How can I edit the .xml tables for the grid to show grid lines (preferably alternating colors)? (I do not have permissions to write actual scripts - I can only alter the .htm… >>> More

  • R and SPSS difference

    as seen on Stack Overflow - Search for 'Stack Overflow'
    i will be analysing vast amount of network traffic related data shortly. i will pre-process the data in order to analyse it. i have found that R and SPSS are among the most popular tools for statistical analysis. i will also be generating quite a lot of graphs and charts. so i was wondering what is… >>> More

  • Automatically compute variable upon input in SPSS

    as seen on Stack Overflow - Search for 'Stack Overflow'
    I have two cells in SPSS, months is a number of months, years_from_months is the number of years, calculated from the months (decimal: months / 12). What I want is that years_from_months is calculated (and updated) automatically, when I finish entering the months in months, i.e. that I don't have… >>> More

  • SPSS launcher for Unity

    as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
    I have "SPSS 20 for Linux" statistical analysis program installed under /opt/IBM directory. I can run it via terminal entering the command line with /opt/IBM, and it runs without any problems. When the program window opens, I go to the launcher and right-click on its icon to lock it there, but after… >>> More

Related posts about loops