Assignment title: Information


ASSIGNMENT 1 STEPS FOR DATA CONSTRUCTION These steps assume that you have already downloaded in data into excel. My excel file is called here demo_original and is saved in my folder C:\Macro for development\Osman\2015-16\Data Exercise. My data consists of real gdp growth (wdi_gdppcgr) and fdi as a share of GDP (fdi_gdp). The others variables are countries (cname=country name and ccodealp=countrycode) and geographical region identifiers (ht_region). 1. OPEN STATA 2. IMPORTING DATA FROM EXCEL INTO STATA: Type in the stata command box (or copy and paste): import excel "C:\Macro for development\Osman\2015-16\Data Exercise\demo_original.xlsx", sheet("Sheet1") firstrow Note: you will need to adjust your folder. For example if your excel file is in the folder is C:\angel then you will have to change the path so that stata knows where to get the excel file from 3. ONCE YOU HAVE YOUR DATA INTO STATA SAVE IT (go to file->save as) or click save (it might be useful to save in the same folder as your excel data. You can check if the data is correctly loaded by going to (data->data editor). Once you are happy, close data editor and go back to your command box By the way I have save my file as: save "C:\Macro for development\Osman\2015-16\Data Exercise\demo_from_excel.dta" 4. NOW YOU ARE READY TO AVERAGE THE DATA. Notice that data covers the period 1970-2014. However, I need to average it over the whole period so that for every country I have a single observation per variable. A word for warning: you must save it (WITH A DIFFERENT NAME) as soon as you average it. IN THE COMMAND BOX TYPE (or copy and paste from here): collapse(mean) fdi_gdp wdi_gdppcgr, by( cname ccodealp ht_region) go to file->save as to save the new data. Here I have saved it as: save "C:\Macro for development\Osman\2015-16\Data Exercise\demo_from_excel_averaged.dta" You can check if the data is correctly loaded by going to (data->data editor). Once you are happy, close data editor and go back to your command box I HAVE ADDED A COUPLE OF COMMANDS IN THIS PRESENCE CASE TO CLEAN THE DATA. THIS IS BECAUSE I DON’T WANT TO USE OBSERVATIONS WHERE FDI OR GROWTH ARE MISSING. SO I HAVE ADDED THIS (BUT YOU MIGHT NOT NEED THIS IN YOUR CASE): drop if wdi_gdppcgr==. THIS WILL DROP OBSERVATION WHERE GDPPC GROWTH IS MISSING drop if fdi_gdp==. THIS WILL DROP OBSERVATION WHERE FDI IS MISSING 5. NOW YOU ARE READY TO RUN THE SCATTER PLOT. PLEASE NOTE HOWEVER THAT IN THIS DEMO EXAMPLE I AM ONLY LIMITING MYSELF TO 34 SUB-SAHARA-AFRICAN COUNTRIES (SSA). This is because I have 211 countries in my data and it will be very difficult to have all of them in the scatter plot (or the plot will look messy: See Figure 1). In your assignment you will only have few countries. By the way to obtain Figure 1; you need to type: two (scatter wdi_gdppcgr fdi_gdp , mlabel(ccodealp)) || (lfit wdi_gdppcgr fdi_gdp ) I select randomly 34 SSA countries and create a new stata file that I call: C:\Macro for development\Osman\2015-16\Data Exercise\demo_from_excel_averaged_SSA.dta THEN TO RUN THE SCATTER PLOT TYPE OR PASTE THE FOLLOWING COMMAND IN THE STATA BOX: two (scatter wdi_gdppcgr fdi_gdp , mlabel(ccodealp)) || (lfit wdi_gdppcgr fdi_gdp ) You will obtain Figure 2 which is much more clearer. THEN TO RUN A CORRELATION TYPE OR PASTE THE FOLLOWING COMMAND IN THE STATA BOX: Correlate wdi_gdppcgr fdi_gdp Figure 1: Messy graph Figure 2: Best graph GOOD LUCK