SPSS Training | SPSS Courses
Call us on 01483 688 488
  • Untitled
  • Statistical Tests Overview
    • Untitled
    • Shapiro-Wilks
    • T Tests
  • Training
  • SPSS Overview - Introduction To The Various Windows
  • Location
  • Contact Us
  • Glossary
  • SPSS Keyboard shortcuts

SPSS Training Tip Number 5 - Using SPSS to choose data between a range of dates

12/3/2012

1 Comment

 
This is one of the simplest yet most effective tips that we give delegates when they attend our SPSS training courses.

If you have a large amount of data, you may consider selecting just one section of it in SPSS to make your analysis easier. One way to do this is to learn to use SPSS’ Select Cases function to choose data associated with a time period - such as between a selection of dates. This is helpful if the raw information you have includes dates of birth, for example. The dates must already be entered into the Data View spreadsheet under a Variable - which we will call Date. They should also be entered in the format day, month, year.

So now you are ready to perform the Select Cases function. First click onto Data in the main toolbar, then Select Cases. On the first box of options that appears, click If Conditions Satisfied, then click OK. On the second box that opens you will need to perform something a little more complex. You will need to type out your own syntax. But once you break it down into steps, this is easier than it sounds.

First of all, click Search in the Function Group dropdown list and Range in the Functions and Special Variables list. The code RANGE(?,?,?) should now appear. It is your job to replace the question marks with meaningful instructions for SPSS to follow.

In place of the first question mark, let SPSS know which variable you want it to focus on. So in this case, you would write ‘date’. Now go on to the second question mark, making sure you leave the comma between the question marks in place.

Here SPSS needs to know the range of dates you want to select and the format they are written in. Write ‘date.dmy’ (the ‘dmy’ stands for day, month year) and then indicate the lowest end of the range you are interested in using the day, month, year format and close it off in brackets. So let’s say you’re looking at data starting on the 1st January 2012, you would write (1.1.2012).

Now you’re going to do exactly the same for your highest end of the range, which we’ll say is 1st August 2012. So in place of the third question mark write ‘date.dmy(1.8.2012)’.

So your code should look like this: RANGE(date, date.dmy(1.1.2012), date.dmy(1.8.2012))

Before you submit the code, make sure you have a double parentheses at the end of it to close off both sets of brackets, then click Continue and then Ok. Now SPSS will block of data outside of those dates.

Click here for more information on Acuity's advanced SPSS training courses.

1 Comment
Dancan Mwatha link
11/1/2017 05:12:25 am

This is highly intellectual document,very helpful,thank you for it and blessings.

Reply



Leave a Reply.

    Author

    Written by the team at Acuity Training

    Archives

    October 2014
    September 2014
    August 2014
    July 2014
    December 2012
    November 2012
    October 2012

    Categories

    All

    RSS Feed

Powered by Create your own unique website with customizable templates.