The variable_details.csv worksheet contain details for the variables in variables.csv
. Information from variable_details.csv
worksheet is used by the rec_with_table()
function to transform variables identified in variable_details$variableStart
to the newly transformed variable in variable_details$variable
.
Each row in variable_details.csv
holds the recode rules for transforming a single category for a variable in variables.csv
. An exception to this rule are the “don’t know”, “refusal”, and “not stated” categories, which are combined as a single missing category. For each unique variable, an else
row is used to assign values not identified in other rows and are outside identified ranges. We recommend not combining variables across the CCHS if variable has an important change between CCHS cycles variable_details$notes
is used to identify issues that may be relevant when transforming the variable or category.
If a categorical variable has 4 distinct categories, along with a “not applicable” category and the 3 missing categories, there will be 7 rows:
4 for each distinct category
1 for the not applicable category
1 for the missing categories
1 else row.
rec_with_table()
uses the tagged_na()
function from the haven package to tag not applicable responses as NA(a)
, and missing values (don’t know, refusal, not stated) as NA(b)
. As you will see later, not applicable values are transformed to NA::a
, and missing values are transformed to NA::b
. See here for more information about tagged_na()
.
The following are the columns that are listed in variable_details.csv
. Many of these columns need to be specified in order for rec_with_table()
to be functional. We will use the sex
variable to illustrate how each column is specified:
variable_details.csv
, we have designated the variable names used in CCHS cycles from 2007 to 2018 as the final transformed variable name.variable |
---|
DHH_SEX |
DHH_SEX |
DHH_SEX |
DHH_SEX |
DHH_SEX |
N/A
. The name of a dummy variable consists of the final variable name, the number of categories in the variable, and the category level for each category. Note that this column is not necessary for rec_with_table()
.variable | dummyVariable | |
---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 |
338 | DHH_SEX | DHH_SEX_cat2_2 |
339 | DHH_SEX | DHH_SEX_cat2_NA::a |
340 | DHH_SEX | DHH_SEX_cat2_NA::b |
341 | DHH_SEX | DHH_SEX_cat2_NA::b |
cat
; while a transformed variable that is continuous will be specified as cont
.variable | dummyVariable | toType | |
---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat |
variable | dummyVariable | toType | databaseStart | |
---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p |
variable | dummyVariable | toType | databaseStart | variableStart | |
---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] |
The categorical sex
variable in the 2001 CCHS survey is DHHA_SEX
. If the final variable name for categorical age in the variable column is DHH_SEX
, you would write the following in this column: cchs2001::DHH_SEX
The categorical age variable in the CCHS surveys from 2007 to 2018 is DHH_SEX
. Since it is the same as the final variable name, you would write in this column [DHH_SEX]
once. The variable name that is denoted within the square brackets is the default variable name.
cat
and continuous variables are denoted as cont
.variable | dummyVariable | toType | databaseStart | variableStart | fromType | |
---|---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat |
copy
so that the function copies the values without any transformations. For the not applicable category, write NA::a
. For missing & else categories, write NA::b
variable | dummyVariable | toType | databaseStart | variableStart | fromType | recTo | |
---|---|---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 1 |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 2 |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::a |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b |
variable_details.csv
, variables that have gone from cat to cont have used midpoints of each category.numValidCat = N/A
. Not applicable, missing, and else categories are not included in the category count. Note that this column is not necessary for rec_with_table()
.variable | dummyVariable | toType | databaseStart | variableStart | fromType | recTo | numValidCat | |
---|---|---|---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 1 | 2 |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 2 | 2 |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::a | 2 |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 |
variable | dummyVariable | toType | databaseStart | variableStart | fromType | recTo | numValidCat | catLabel | |
---|---|---|---|---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 1 | 2 | Male |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 2 | 2 | Female |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::a | 2 | not applicable |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing |
variable | dummyVariable | toType | databaseStart | variableStart | fromType | recTo | numValidCat | catLabel | catLabelLong | |
---|---|---|---|---|---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 1 | 2 | Male | Male |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 2 | 2 | Female | Female |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::a | 2 | not applicable | not applicable |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing |
N/A
. Note, the function will not work if there different units between the rows of the same variable (i.e. height using both m and ft).variable | dummyVariable | toType | databaseStart | variableStart | fromType | recTo | numValidCat | catLabel | catLabelLong | units | |
---|---|---|---|---|---|---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 1 | 2 | Male | Male | N/A |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 2 | 2 | Female | Female | N/A |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::a | 2 | not applicable | not applicable | N/A |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A |
The rules for each category of a new variable are a string in recFrom
and value in recTo
. These recode pairs are the same syntax as interval notation in which a closed range of values are specified using square brackets. See here for more information on interval notation. Recode pairs are obtained from the RecFrom and RecTo columns value range is indicated by a comma, e.g. recFrom= [1,4]; recTo = 1
(recodes all values from 1 to 4 into 1} value range for double vectors (with fractional part), all values within the specified range are recoded; e.g. recFrom = [1,2.5]; recTo = 1
recodes 1 to 2.5 into 1, but 2.55 would not be recoded (since it’s not included in the specified range). NA is used for missing values (don’t know, refusal, not stated) else is used all other values, which have not been specified yet, are indicated by else
, e.g. recFrom = "else"; recTo = NA
(recode all other values (not specified in other rows) to “NA”)} copy the else
token can be combined with copy
, indicating that all remaining, not yet recoded values should stay the same (are copied from the original value), e.g. recFrom = "else"; recTo = "copy"
variable | dummyVariable | toType | databaseStart | variableStart | fromType | recTo | numValidCat | catLabel | catLabelLong | units | recFrom | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 1 | 2 | Male | Male | N/A | 1 |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 2 | 2 | Female | Female | N/A | 2 |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::a | 2 | not applicable | not applicable | N/A | 6 |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A | [7,9] |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A | else |
bllflow
helper functions. See bllflow documentation.variable | dummyVariable | toType | databaseStart | variableStart | fromType | recTo | numValidCat | catLabel | catLabelLong | units | recFrom | catStartLabel | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 1 | 2 | Male | Male | N/A | 1 | Male |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 2 | 2 | Female | Female | N/A | 2 | Female |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::a | 2 | not applicable | not applicable | N/A | 6 | not applicable |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A | [7,9] | don’t know (7); refusal (8); not stated (9) |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A | else | else |
variable | dummyVariable | toType | databaseStart | variableStart | fromType | recTo | numValidCat | catLabel | catLabelLong | units | recFrom | catStartLabel | variableStartShortLabel | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 1 | 2 | Male | Male | N/A | 1 | Male | Sex |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 2 | 2 | Female | Female | N/A | 2 | Female | Sex |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::a | 2 | not applicable | not applicable | N/A | 6 | not applicable | Sex |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A | [7,9] | don’t know (7); refusal (8); not stated (9) | Sex |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A | else | else | Sex |
variable | dummyVariable | toType | databaseStart | variableStart | fromType | recTo | numValidCat | catLabel | catLabelLong | units | recFrom | catStartLabel | variableStartShortLabel | variableStartLabel | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 1 | 2 | Male | Male | N/A | 1 | Male | Sex | Sex |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 2 | 2 | Female | Female | N/A | 2 | Female | Sex | Sex |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::a | 2 | not applicable | not applicable | N/A | 6 | not applicable | Sex | Sex |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A | [7,9] | don’t know (7); refusal (8); not stated (9) | Sex | Sex |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A | else | else | Sex | Sex |
recode-with-table
function. Things to include here would be changes in wording between CCHS surveys, missing/changes in categories, and changes in variable type between CCHS surveys.variable | dummyVariable | toType | databaseStart | variableStart | fromType | recTo | numValidCat | catLabel | catLabelLong | units | recFrom | catStartLabel | variableStartShortLabel | variableStartLabel | notes | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
337 | DHH_SEX | DHH_SEX_cat2_1 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 1 | 2 | Male | Male | N/A | 1 | Male | Sex | Sex | |
338 | DHH_SEX | DHH_SEX_cat2_2 | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | 2 | 2 | Female | Female | N/A | 2 | Female | Sex | Sex | |
339 | DHH_SEX | DHH_SEX_cat2_NA::a | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::a | 2 | not applicable | not applicable | N/A | 6 | not applicable | Sex | Sex | |
340 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A | [7,9] | don’t know (7); refusal (8); not stated (9) | Sex | Sex | |
341 | DHH_SEX | DHH_SEX_cat2_NA::b | cat | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p, cchs2015_2016_p, cchs2017_2018_p | cchs2001_p::DHHA_SEX, cchs2003_p::DHHC_SEX, cchs2005_p::DHHE_SEX, [DHH_SEX] | cat | NA::b | 2 | missing | missing | N/A | else | else | Sex | Sex |
The same naming convention applies to derived variables with the exception of two columns:
DerivedVar::[var1, var2, var3]
Func::derivedFunction
A derived variable looks like this in variable_details.csv
variable | dummyVariable | toType | databaseStart | variableStart | fromType | recTo | numValidCat | catLabel | catLabelLong | units | recFrom | catStartLabel | variableStartShortLabel | variableStartLabel | notes | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7 | derivedVariable | N/A | cont | cchs2001_p, cchs2003_p, cchs2005_p, cchs2007_2008_p, cchs2009_2010_p, cchs2010_p, cchs2011_2012_p, cchs2012_p, cchs2013_2014_p, cchs2014_p | DerivedVar::[var1, var2, var3] | N/A | Func::derivedFunction | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | Derived variable from var1, var2, var3 |