Data & Intelligence

# Computing New Variables in IBM SPSS

## Computing New Variables

IBM SPSS Statistics offers more than 70 built-in functions to compute new variables based on your corporate logic. These include:

• Arithmetic functions

• Statistical functions

• Distribution functions

• Logical functions

• Date and time aggregation and extraction functions

• Missing-value functions

• Cross-case functions

• String functions

##### 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

These functions are available from the “Compute Variable” dialog (as we’ll see below).

A simple example would be to compute a variable that is the difference between the values of two existing variables in your data pond.

Sample data provided in the SPSS statistics tutorial can be used to demonstrate:

A data pond of responses from an online survey contains a respondent’s current age and the number of years he or she worked at a current job. It does not, however, contain information for the respondent’s age at the time he or she started that job, so  IBM SPSS Statistics can compute the difference between “current age” and” the number of years at the current job” (which should be the approximate age at which the respondent started that job).

## Example

To compute our new variable we use the “Compute Variable” dialog, so from the menus in the Data Editor window choose:

Transform > Compute Variable…

1. For Target Variable, we need to name our new variable so we enter ”jobstart”
2. Select Age in years [age] in the source variable list and click the arrow button to copy it to the Numeric Expression text box.
3. Click the minus (–) button on the calculator pad in the dialog box.
4. Select Years with current employer [employ] and click the arrow button to copy it to the expression.

Now we have our formula:

age – Years with current employer

Now click OK to compute the new variable.

The new variable is displayed in the Data Editor:

Our new variable if now part of our data and is ready for further analysis!

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