- Data Analysis with IBM SPSS Statistics
- Kenneth Stehlik Barry Anthony J. Babinec
- 305字
- 2021-07-02 18:13:49
Demo - adding variable properties via syntax
Here is the syntax to specify variable labels, value labels, missing values, and levels of measurement for the GSS 2014 data extract.
Here are the Variable Labels:
VARIABLE LABELS
ID "Respondent id number"
MARITAL "Marital status"
AGE "Age of respondent"
SEX "Respondents sex"
HAPPY "General happiness"
.
You can facilitate readability by providing one variable name and label per line. Note the period in its own line. That is not required, but makes the period easy to see.
Here are the Value Labels:
VALUE LABELS
MARITAL
1 "Married"
2 "Widowed"
3 "Divorced"
4 "Separated"
5 "Never married"
9 "No answer"
/ AGE
89 "89 or older"
98 "Don't know"
99 "No answer"
/ SEX
'f' "Female"
'm' "Male"
/ HAPPY
1 "Very happy"
2 "Pretty happy"
3 "Not too happy"
0 "Not applicable"
8 "Don't know"
9 "No answer"
.
For readability, enter one value and label per line. Note the use of the slash (/) as a separator. Additionally, as the codes for SEX are string values, enclose the values in matching quotes.
Here is the Missing Values specification:
MISSING VALUES
MARITAL(9)
/ AGE(98,99)
/ HAPPY(0,8,9)
.
For readability, specify one variable per line and use the slash as a separator.
Here is the Variable Level specification:
VARIABLE LEVEL
ID,AGE(SCALE)
/ HAPPY(ORDINAL)
/ MARITAL(NOMINAL)
.
As a shortcut, use lists to name variables that are the same Variable Level.
Select and run the syntax. The Variable View updates immediately. To see the effect of adding variable properties, here is the frequency table for MARITAL after executing the syntax and rerunning frequencies:

Now, the table has nice labels for the marital status categories, and the four cases with data codes of 9 are set off in a separate part of the table where the missing data is summarized.
aeaak
- Maven Build Customization
- C#程序設計教程
- Expert Android Programming
- GeoServer Beginner's Guide(Second Edition)
- 微信小程序入門指南
- UVM實戰
- 機器學習與R語言實戰
- Node.js開發指南
- Serverless Web Applications with React and Firebase
- Getting Started with Python
- Natural Language Processing with Python Quick Start Guide
- 跟戴銘學iOS編程:理順核心知識點
- Instant Automapper
- HTML5移動Web開發
- Visual Basic語言程序設計基礎(第3版)