generate_race_var
ACS and CPS microdata utilities
Generate a race-ethnicity variable in ACS or CPS microdata.
Description
generate_race_var generates a categorical variable for race-ethnicity in ACS or CPS microdata.
Users may specify the desired number of categories for the new variable; see Categories and labels.
In ACS microdata, the variables rac1p and hisp must exist. In CPS microdata, the variables prdtrace and pehspnon must exist.
Syntax
generate_race_var newvar, dataset(acs|cps) categories(integer) [options]| Option | Description |
|---|---|
dataset(string) |
The type of dataset in memory; ACS or CPS (case insensitive). |
categories(integer) |
Number of categories for newvar. With dataset(acs), up to 8. With dataset(cps), up to 7. See Categories and Labels. |
nolabel |
Do not assign variable or value labels to newvar. |
Categories and labels
| Categories | Values and Labels |
|---|---|
| 2 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 (ACS) |
|
| 7 (CPS) |
|
| 8 (ACS only) |
|
Examples
Generate a 5-category race-ethnicity variable in ACS microdata.
generate_race_var race_cat, dataset("acs") categories(5) Generate an unlabeled 2-category race-ethnicity variable in CPS microdata.
generate_race_var person_of_color, categories(2) dataset("cps") nolabel