Skip to main content

Data & Intelligence

IBM SPSS Time

IBM SPSS defines each variable with a “TYPE”. By default, all variables in SPSS are assumed to be numeric until you change them. SPSS V20 currently supports the following variable types:

  • Numeric and String (the most common),
  • Comma,
  • Dot,
  • Scientific Notation,
  • Date,
  • Dollar,
  • Custom Currency and
  • Restricted Numeric

What day is it?

Today I want to focus on “Date” variables which are generally termed “Date/Time variables” (for those of you “old schools”, you might know these variables as “date-format variables”).

It is also important to know that these variables can be divided into (1) those that actually represent dates and (2) those that are used to hold time durations.

In IBM SPSS, both kinds of date variables are actually numeric values with assigned display formats. The first, (those that represent actual dates) use a format such as:

MM/DD/YYYY

While the second kind (those that represent a date and time), use a format such as:

DD-MMMM-YYYY: MM:SS

 I won’t go into detail on the formatting possibilities here (that’s what the help file is for!) but below are some exerts:

  • Both two- and four-digit year specifications are recognized.
  • Dashes, periods, commas, slashes, or blanks can be used as delimiters in day-month-year formats.
  • Months can be represented in digits, Roman numerals, or three-character abbreviations and they can be fully spelled out.
  • In time specifications (applies to date/time and duration variables), colons can be used as delimiters between hours, minutes, and seconds. Hours and minutes are required, but seconds are optional. A period is required to separate seconds from fractional seconds.
  • The system variable $TIME holds the current date and time. It represents the number of seconds from October 14, 1582, to the date and time when the transformation command that uses it is executed.

Wizard!

SPSS thoughtfully supplies us with a “Date and Time Wizard” meant to simplify   our life when performing a number of common chores associated with our date and time variables.

 

To access this wizard, you can click on Transform (in the Statistics Viewer) and then

Data Intelligence - The Future of Big Data
The Future of Big Data

With some guidance, you can craft a data platform that is right for your organization’s needs and gets the most return from your data capital.

Get the Guide

select Date and Time Wizard…

 

 

 

 

 

 

 

 

 

 

 

From the “Date and Time Wizard” dialog you can select the following options:

  • Learn how dates and times are represented. This choice leads to a screen that provides a brief overview of date/time variables in SPSS -in case you were too lazy to just go to help :).
  • Create a date/time variable from a string containing a date or time. Use this option to create a date/time variable from a string variable in your current dataset. I use this one a lot (no programing required!). The wizard shows you all the string variables in your current data file, the value of each and gives you the ability to select the exact formatting you want to use for the new variable.
  • Create a date/time variable from variables holding parts of dates or times. This choice allows you to construct a date/time variable from a set of existing variables. Again, very useful. If your data file has date and time information in separated variables, for example year month and day all being separate – you can use this wizard option to “paste” them together in one nicely formatted variable field.
  • Calculate with dates and times. Use this option to add or subtract values from date/time variables. Again, no programming involved – you can add or subtract a “duration amount” from a date or date/time variable or even compute the total time units between two dates.
  • Extract a part of a date or time variable. This option allows you to extract part of a date/time variable, such as the day of the month from a date/time variable, which has the form mm/dd/yyyy.  Kind of cool – you can use this option to make a new variable from any “part” of an existing date or time variable.
  • Assign periodicity to a dataset. This choice takes you to the Define Dates dialog box, used to create date/time variables that consist of a set of sequential dates.  This option is a little more interesting – you can use it to create new date or time “sequential” or “date association” variables.

 

Until next time,

JDM

 

“Ah, then it’s a gift.”
Doctor Zhivago (1965)

 

 

Thoughts on “IBM SPSS Time”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Jim Miller

Mr. Miller is an IBM certified and accomplished Senior Project Leader and Application/System Architect-Developer with over 30 years of extensive applications and system design and development experience. His current role is National FPM Practice Leader. His experience includes BI, Web architecture & design, systems analysis, GUI design and testing, Database modeling and systems analysis, design, and development of Client/Server, Web and Mainframe applications and systems utilizing: Applix TM1 (including TM1 rules, TI, TM1Web and Planning Manager), dynaSight - ArcPlan, ASP, DHTML, XML, IIS, MS Visual Basic and VBA, Visual Studio, PERL, Websuite, MS SQL Server, ORACLE, SYBASE SQL Server, etc. His Responsibilities have included all aspects of Windows and SQL solution development and design including: analysis; GUI (and Web site) design; data modeling; table, screen/form and script development; SQL (and remote stored procedures and triggers) development and testing; test preparation and management and training of programming staff. Other experience includes development of ETL infrastructure such as data transfer automation between mainframe (DB2, Lawson, Great Plains, etc.) systems and client/server SQL server and Web based applications and integration of enterprise applications and data sources. In addition, Mr. Miller has acted as Internet Applications Development Manager responsible for the design, development, QA and delivery of multiple Web Sites including online trading applications, warehouse process control and scheduling systems and administrative and control applications. Mr. Miller also was responsible for the design, development and administration of a Web based financial reporting system for a 450 million dollar organization, reporting directly to the CFO and his executive team. Mr. Miller has also been responsible for managing and directing multiple resources in various management roles including project and team leader, lead developer and applications development director. Specialties Include: Cognos/TM1 Design and Development, Cognos Planning, IBM SPSS and Modeler, OLAP, Visual Basic, SQL Server, Forecasting and Planning; International Application Development, Business Intelligence, Project Development. IBM Certified Developer - Cognos TM1 (perfect score 100% on exam) IBM Certified Business Analyst - Cognos TM1

More from this Author

Follow Us