1 / 21

Currency Coding in Share Life

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

aliza
Download Presentation

Currency Coding in Share Life

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Currency Codingin Share Life Christian Hunkler

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

  3. Currency Coding - Examples • E.g. RC module: MATERNITY BENEFIT AMOUNT rc032Can 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 module e.g. ac023/ac024 sale price of owned property • RE module e.g. re021/re022 first monthly wage in job

  4. Currency Coding - 3 Problems Anything that can go wrong, went! wrong concerning currencies • 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

  5. 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? Currency Coding - Examples Poland • marki • “Deutsche Mark”, “Mark der DDR”, “Reichsmark”; Finnish Markkaa; there are more marks!

  6. 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 variables • Raw Currency Codes (RCC), to be distributed to users • Coding 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 Rupees • Generated Currency Codes (GCC), coordinated by MEA; any other good “hypothesis” are welcome: Interviewer • Step 3 – Involve experts to develop Generated Amounts

  7. 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

  8. 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

  9. 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 Folder global STUB "sharew3_" // Filenames without module suffix global COUNTRY "de" // Select your country global OUTPATH "L:/temp" // Specify a directory to store the // the final file and a couple of // temporary files *------------------------------------------------------------------------ clear version 9.0 set mem 300m pause off set more off *** NO CHANGES NEEDED BELOW ***

  10. 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 strings clear set obs 1 // one empty line added gen str20 currency = "" save "${OUTPATH}/currency_coding_`c'.dta", replace *>> select currency variables use "${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 use global cvars_`c'_`m' `r(varlist)'

  11. share_w3_de_01_currency_coding_EXTRACT_STRINGS_vers_01.do *>> extract each currency variable, drop duplicates/empty strings foreach var of global cvars_`c'_`m' { use `var' using "${INPATH}/${STUB}`m'.dta", clear rename `var' currency duplicates 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 modules duplicates drop keep if currency!="" // the one empty line is dropped save "${OUTPATH}/currency_coding_`c'_`m'.dta", replace

  12. share_w3_de_01_currency_coding_EXTRACT_STRINGS_vers_01.do *>> aggregate it within countries use "${OUTPATH}/currency_coding_`c'_ac.dta", clear foreach 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 again replace currency = lower(itrim(trim(currency))) duplicates drop keep if currency!="" *>> save final coding file country wise save "${OUTPATH}/currency_coding_`c'.dta", replace *>> erase temporary files foreach 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

  13. 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

  14. 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 …

  15. 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" CURRENCIES replace ${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") …

  16. 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 strings replace ${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 codes drop if ${CURVAR}c != . . list . // NO MORE STRINGS IN FILE, CODING IS DONE :-)

  17. 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 variables use "${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 module use "${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 } } }

  18. 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: • You have to change the label search command: – quietly ds, has(varlabel *currency*) – • We send you a file containing all unique currency strings for your country

  19. 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

  20. MEA Wants • 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 • 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 • Any good ideas/experts/expertise on how to reduce the remaining problems

  21. Thank you

More Related