21
Currency Coding in Share Life Christian Hunkler

Currency Coding in Share Life

  • Upload
    ira

  • View
    14

  • Download
    0

Embed Size (px)

DESCRIPTION

Currency Coding in Share Life. Christian Hunkler. If you already started with currency coding, we will adapt your programs to this scheme. Currency Coding - Examples. E.g. RC module: MATERNITY BENEFIT AMOUNT - PowerPoint PPT Presentation

Citation preview

Page 1: Currency Coding in Share Life

Currency Codingin Share Life

Christian Hunkler

Page 2: Currency Coding in Share Life

If you already started with currency coding, we will adapt your programs to this scheme

2

Page 3: Currency Coding in Share Life

Currency Coding - Examples

E.g. RC module: MATERNITY BENEFIT AMOUNTrc032 Can you tell me how much was your first net

monthly maternity benefit when you had [{name other child}]?IWER:Enter amount. Enter currency at next question

rc033 IWER:Please ask or code: Which currency was this in?

AC modulee.g. ac023/ac024 sale price of owned property

RE modulee.g. re021/re022 first monthly wage in job

3

Page 4: Currency Coding in Share Life

Currency Coding - 3 Problems

Respondents think in various pre-Euro currencies - R’s life-spans cover various currencies & currency reforms - R’s lived in different countries and report in these currencies,

either using their actual names/abbreviations, or not - R’s supply non-standard or local currency

abbreviations/names, - Or without exact specification (e.g. “francs”: french, swiss,…?)

Interviewers - I’s enter amounts instead of currencies- I’s enter answers to other questions instead of currencies- typos

Strings- Strings allow R’s and I’s to fully charge us with all these issues- Currency abbreviations are short (2-/3-digits),

difficult to unambiguously identify typos

4

Anything that can go wrong, went! wrong concerning currencies

Anything that can go wrong, went! wrong concerning currencies

Page 5: Currency Coding in Share Life

Currency Coding - Examples

Switzerland

francs suisses

schw.fr

hospice general

franchi

fr

fr.

a-dollar

Did the last 3 R’s maybe live in Luxemburg, or in France?

Whats “a dollar”?

Spain

pesetas y euros

8000000.00

uros

pesertas

Is uros a typo of Euros, or something else?

Poland

marki

“Deutsche Mark”, “Mark der DDR”, “Reichsmark”; Finnish Markkaa; there are more marks!

5

Page 6: Currency Coding in Share Life

Currency Coding - General Process

In total 1186 unique currency strings (15.05.2009); between 28 (FR) and 192 (CH) per country

Step 1 – Assess the Mess- Code strings as conservative as possible into numeric variablesRaw Currency Codes (RCC), to be distributed to usersCoding by country teams (MEA supplies templates)

Step 2 – Use all countries inf. to reduce unknown codes- e.g. from various countries we see a currency “PKR” and majority

of these respondents lived in Pakistan; Pakistan RupeesGenerated Currency Codes (GCC), coordinated by MEA;

any other good “hypothesis” are welcome: Interviewer

Step 3 – Involve experts to develop Generated Amounts

6

Page 7: Currency Coding in Share Life

Currency Coding Step 1 “Assess the mess”

Users should be given access to the raw data as close as possible to be able to recode their own measures

Coding Rules for Raw Currency Codes (RCC)

- Only code “safe” answers into currency codes[If you did not start yet, please use our currency code list]

- Do not impose any additional assumptions- Do not pick “the likeliest” currency

- Rather use additional codes (>300) for uncertain strings

- Additional Codes New standard missing codes (-2=“refusal”; -1=“don’t know”)

-6 : amount instead of currency

-7 : answer to different question

7

Page 8: Currency Coding in Share Life

Currency Coding Step 1 “Assess the mess”

3 Template Do Files

share_w3_CC_01_currency_coding_EXTRACT_STRINGS_vers_01.do extracts all currency variables from all modules, deletes duplicates, and stores all unique currency strings in country-specific file(s)

share_w3_CC_02_currency_coding_CODE_SCHEME_vers_01.dotemplate with sample commands for German data on how to code currency variables using globals

share_w3_CC_03_currency_coding_APPLY_SCHEME_vers_01.do applies the code-scheme from the previous program to all currency variables in all modules

8

Page 9: Currency Coding in Share Life

share_w3_de_01_currency_coding_EXTRACT_STRINGS_vers_01.do

*----[0: PREPARATIONS (i.e. path definitions...)]------------------------

global INPATH "L:/MEA_R/20090515/CAPI/de" // Data Folderglobal STUB "sharew3_" // Filenames without module suffixglobal COUNTRY "de" // Select your country

global OUTPATH "L:/temp" // Specify a directory to store the // the final file and a couple

of // temporary files

*------------------------------------------------------------------------

clearversion 9.0set mem 300m

pause offset more off

*** NO CHANGES NEEDED BELOW ***

9

Page 10: Currency Coding in Share Life

share_w3_de_01_currency_coding_EXTRACT_STRINGS_vers_01.do

*----[I: EXTRACT CURRENCY STRINGS FROM ALL MODULES]----------------------

foreach c in $COUNTRY {quietly {foreach m in ac cs cv_r fq fs gl hc hs iv ls mn rc re rp st xt {

*>> prepare empty dataset to store all currency stringsclear set obs 1 // one empty line addedgen str20 currency = ""save "${OUTPATH}/currency_coding_`c'.dta", replace

*>> select currency variablesuse "${INPATH}/${STUB}`m'.dta",clear quietly ds, has(varlabel *currency*) // r(varlist) holds list

// of vars with currency

*>> store varlist as global to have it available for later useglobal cvars_`c'_`m' `r(varlist)'

10

Page 11: Currency Coding in Share Life

share_w3_de_01_currency_coding_EXTRACT_STRINGS_vers_01.do

*>> extract each currency variable, drop duplicates/empty stringsforeach var of global cvars_`c'_`m' {

use `var' using "${INPATH}/${STUB}`m'.dta", clearrename `var' currencyduplicates drop keep if currency!=""save "${OUTPATH}/tempfile_`c'_`m'_`var'.dta", replace

}

*>> use empty dataset and append all single currency vars use "${OUTPATH}/currency_coding_`c'.dta", clear

foreach var of global cvars_`c'_`m' {append using "${OUTPATH}/tempfile_`c'_`m'_`var'.dta"

}

*>> aggregate it within modulesduplicates drop keep if currency!="" // the one empty line is droppedsave "${OUTPATH}/currency_coding_`c'_`m'.dta", replace

11

Page 12: Currency Coding in Share Life

share_w3_de_01_currency_coding_EXTRACT_STRINGS_vers_01.do

*>> aggregate it within countriesuse "${OUTPATH}/currency_coding_`c'_ac.dta", clearforeach m in cs cv_r fq fs gl hc hs iv ls mn rc re rp st xt { append using "$OUTPATH/currency_coding_`c'_`m'.dta"}

*>> Make basic string corrections, get rid of duplicates againreplace currency = lower(itrim(trim(currency)))

duplicates dropkeep if currency!=""

*>> save final coding file country wisesave "${OUTPATH}/currency_coding_`c'.dta", replace

*>> erase temporary filesforeach m in ac cs cv_r fq fs gl hc hs iv ls mn rc re rp st xt { erase "${OUTPATH}/currency_coding_`c'_`m'.dta"}} //quietly end

12

Page 13: Currency Coding in Share Life

share_w3_de_02_currency_coding_CODE_SCHEME_vers_01.do

*----[0: PREPARATIONS (i.e. path definitions...)]-----------------------

global COUNTRY "de" // Select your country

global OUTPATH "L:/temp" // Specify the same directory as in // Do File 1, where final file of do// file 1 is stored

use $OUTPATH/currency_coding_${COUNTRY}.dta, replace

global CURVAR currency // store it as global, as the code scheme // developed for this list of strings is

// used for all "real" currency variables

// in all modules // therefore we need a "container" we can

// replace with real variable names later

// on

*** out-comment everything above for use in program 3

13

Page 14: Currency Coding in Share Life

share_w3_de_02_currency_coding_CODE_SCHEME_vers_01.do

*----[1: CODING SECTION]------------------------------------------------gen ${CURVAR}c = . // generate numeric variable holding coded version // of CURVAR

*>> STATA LABELS

lab var ${CURVAR}c „Currency Code Sheme for country: ${COUNTRY}"

lab def ${CURVAR}c -6 "amount instead of currency" , modify lab def ${CURVAR}c -7 "answer to different question" , modify

lab def ${CURVAR}c -2 "refusal" , modify lab def ${CURVAR}c -1 "don't know" , modify

lab def ${CURVAR}c 1 "eur - euro" , modify lab def ${CURVAR}c 5 "bef - belgian franc" , modify …lab def ${CURVAR}c 14 "chf - swiss francs" , modify lab def ${CURVAR}c 15 "cyp - cyprus pound" , modify …

14

Page 15: Currency Coding in Share Life

share_w3_de_02_currency_coding_CODE_SCHEME_vers_01.do

*>> CODE NUMBERS & OTHER SUBSTANTIVE ANSWERS; REFUSALS; CORRECT TYPOS OF KNOWN CURRENCIES

replace ${CURVAR}c = -2 if inlist($CURVAR, "#refusal#")replace ${CURVAR}c = -1 if inlist($CURVAR, "#don't know#")

replace ${CURVAR}c = -6 if inlist($CURVAR, "30","270","270","320")replace ${CURVAR}c = -6 if inlist($CURVAR, "1170","0","00","2200")replace ${CURVAR}c = -6 if inlist($CURVAR, "300000","150","420")

replace ${CURVAR}c = -7 if inlist($CURVAR, "1952","sekretärin")

*>> CODE EUROS & "SAVE" CURRENCIESreplace ${CURVAR}c = 1 if inlist($CURVAR, "euro","euro","eur", "euo")

replace ${CURVAR}c = 18 if inlist($CURVAR, "dm","deutache mark")replace ${CURVAR}c = 18 if inlist($CURVAR, "deutsche mark","d-mark")…

replace ${CURVAR}c = 17 if inlist($CURVAR, "mark der ddr","ddr mark")…

15

Page 16: Currency Coding in Share Life

share_w3_de_02_currency_coding_CODE_SCHEME_vers_01.do

*>> once in a while: drop all already coded strings:drop if ${CURVAR}c != . // out-comment this for use in program 3

*>> and open data browser again to check the remaining strings:br // abbreviation for browse out-comment this

*>> Use >300 codes for all remaining stringsreplace ${CURVAR}c =341 if inlist($CURVAR, "deputat (naturalien)")replace ${CURVAR}c =342 if inlist($CURVAR, "ru")replace ${CURVAR}c =343 if inlist($CURVAR, "lat")replace ${CURVAR}c =344 if inlist($CURVAR, "tjige")replace ${CURVAR}c =345 if inlist($CURVAR, "ruel")

*** out-comment everything below for use in program 3

*>> you are done if all strings are represented by numeric codesdrop if ${CURVAR}c != . . list. // NO MORE STRINGS IN FILE, CODING IS DONE :-)

16

Page 17: Currency Coding in Share Life

share_w3_de_03_currency_coding_APPLY_SCHEME_vers_01.do

*----[0: PREPARATIONS (i.e. path definitions...)]--- as before

foreach c in $COUNTRY {foreach m in ac cs cv_r fq fs gl hc hs iv ls mn rc re rp st xt {

*>> select currency variablesuse "${INPATH}/${STUB}`m'.dta",clear quietly ds, has(varlabel *currency*)

global cvars_`c'_`m' `r(varlist)' // store varlist as global

*>> label currency variables in each moduleuse "${INPATH}/${STUB}`m'.dta", clear

foreach var of global cvars_`c'_`m' {global CURVAR `var' replace `var' = lower(itrim(trim(`var')))do "${DOFILE}/share_w3_de_02_currency_coding_CODE_SCHEME.do"save "${OUTPATH}/sharew3_`m'_withcurcodes.dta", replace

}}}

17

Page 18: Currency Coding in Share Life

Currency Coding Step 1 “Assess the mess”

Risky assumption The procedure takes only currency string variables into

account that have „currency“ in their variable label So, if you discover any other variable including

currencies but having a different label, let us know

If labels are changed, e.g. non-English labels, the procedure will not work anymore. Remedies: 1.You have to change the label search command:

– quietly ds, has(varlabel *currency*) – 2.We send you a file containing all unique currency

strings for your country

18

Page 19: Currency Coding in Share Life

Suggestions for Step 1 “Assess the mess”

1. Easiest to code all typos of country’s actual/pre-Euro currency [swiss francs, s.f., …]

2. Easy to code “country & currencies” formatted answers [argent. pesos]

For 1. & 2., please use Share_w3_all_CurrencyCodePlan.xls

3. Easy to code “currency names”, please do not make assumptions here [dollar, mark, …]its obvious for “dollars” or “marks” that it might be misleading; and maybe is also for other currency names

4. Check remaining strings, maybe there are some more strings with only minor typos

For 3. & 4., develop own codes, preferably >300

19

Page 20: Currency Coding in Share Life

MEA Wants

1. Program 2 or similar styled list of strings, their codes, and codeplan

use the Stata template files, or if you use SPSS, please use a format (tabs, spaces) that allows easy transformation

2. List of currencies in use during respondents life span, preferably including- English currency name, - Date of currency being effective [& Expiration Date]

i.e. currency reforms- Typically used abbreviation codes for these currencies

3. Any good ideas/experts/expertise on how to reduce the remaining problems

20

Page 21: Currency Coding in Share Life

Thank you

21