Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9285565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T19:11:54+00:00 2026-06-18T19:11:54+00:00

I have a dataset in SPSS that has 100K+ rows and over 100 columns.

  • 0

I have a dataset in SPSS that has 100K+ rows and over 100 columns. I want to filter both the rows and columns at the same time into a new SPSS dataset.

I can accomplish this very easily using the subset command in R. For example:

new_data = subset(old_data, select = ColumnA >10, select = c(ColumnA, ColumnC, ColumnZZ))

Even easier would be:

new data  = old_data[old_data$ColumnA >10, c(1, 4, 89)]

where I am passing the column indices instead.

What is the equivalent in SPSS?

I love R, but the read/write and data management speed of SPSS is significantly better.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T19:11:55+00:00Added an answer on June 18, 2026 at 7:11 pm

    I am not sure what exactly you are referring to when you write that “the read/write and data management speed of SPSS being significantly better” than R. Your question itself demonstrates how flexible R is at data management! And, a dataset of 100k rows and 100 columns is by no means a large one.

    But, to answer your question, perhaps you are looking for something like this. I’m providing a “programmatic” solution, rather than the GUI one, because you’re asking the question on Stack Overflow, where the focus is more on the programming side of things. I’m using a sample data file that can be found here: http://www.ats.ucla.edu/stat/spss/examples/chp/p004.sav

    Save that file to your SPSS working directory, open up your SPSS syntax editor, and type the following:

    GET FILE='p004.sav'.
    SELECT IF (lactatio <= 3).
    SAVE OUTFILE= 'mynewdatafile.sav'
      /KEEP currentm previous lactatio.
    GET FILE='mynewdatafile.sav'.
    

    More likely, though, you’ll have to go through something like this:

    FILE HANDLE directoryPath /NAME='C:\path\to\working\directory\' . 
    FILE HANDLE myFile /NAME='directoryPath/p004.sav' . 
    GET FILE='myFile'.
    SELECT IF (lactatio <= 3).
    SAVE OUTFILE= 'directoryPath/mynewdatafile.sav'
      /KEEP currentm previous lactatio.
    FILE HANDLE myFile /NAME='directoryPath/mynewdatafile.sav'.
    GET FILE='myFile'.
    

    You should now have a new file created that has just three columns, and where no value in the “lactatio” column is greater than 3.

    So, the basic steps are:

    1. Load the data you want to work with.
    2. Subset for all columns from all the cases you’re interested in.
    3. Save a new file with only the variables you’re interested in.
    4. Load that new file before you proceed.

    With R, the basic steps are:

    1. Load the data you want to work with.
    2. Create an object with your subset of rows and columns (which you know how to do).

    Hmm…. I don’t know about you, but I know which method I prefer 😉

    If you’re using the right tools with R, you can also directly read in the specific subset you are interested in without first loading the whole dataset if speed really is an issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dataset that I need to filter by time. e.g. I want
I have two dataset (each has two columns of data). I want to use
I have a dataset that has two tables in it. I want to do
I have DataSet which has 3 columns. Name - insurance comp. name - treatmentDate
I have a dataset with one datatable. Now I want to set a filter
I have a dataset that can come with 5 columns, columns 6, 7, 10,
I have a DataSet where I need to find out how many rows has
i have C# program, i have DataSet that i want to bind to crystal
I have a dataset with a lot of columns I want to import into
I have a dataset of 15 columns. I want to generate an excel sheet

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.