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

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

主站蜘蛛池模板: 玉环县| 盐津县| 淮南市| 甘孜| 桐城市| 南投市| 静宁县| 大埔区| 万宁市| 洞口县| 开平市| 东山县| 常熟市| 河北省| 甘南县| 托里县| 利辛县| 玛纳斯县| 永寿县| 宜宾市| 科技| 会宁县| 剑阁县| 深泽县| 福建省| 蓬溪县| 宕昌县| 洪江市| 麻江县| 巴林右旗| 固安县| 湘乡市| 台江县| 郧西县| 普安县| 中方县| 原阳县| 宜丰县| 原阳县| 灌南县| 墨江|