官术网_书友最值得收藏!

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

主站蜘蛛池模板: 喜德县| 贞丰县| 修文县| 女性| 襄城县| 分宜县| 太康县| 永昌县| 铜陵市| 大厂| 盈江县| 哈巴河县| 金川县| 光泽县| 花莲市| 普安县| 信宜市| 即墨市| 临夏市| 沙河市| 通城县| 武威市| 婺源县| 晋州市| 河西区| 泊头市| 雅安市| 商水县| 泌阳县| 平顶山市| 高清| 马尔康县| 泗水县| 盐城市| 图木舒克市| 苍梧县| 阜平县| 青州市| 南乐县| 县级市| 连南|