The data has variable names in numerical form (i.e. number of months prior to and following an event). If I import the excel file I lose the variable names – ie replaced with the excel column letters. Alternatively, if I transpose the data in excel I can obtain the months as a variable. However, I then have a challenge transposing event names to become observations
Eg excel cells look like this
event | -2 | -1 | 0 |
United Nations Sustainable Development Summit | 62 | 42 | 228 |
Volkswagen emissions scandal | 49 | 41 | 2071 |
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input str45 event byte(B C) int D "United Nations Sustainable Development Summit" 62 42 228 "Volkswagen emissions scandal" 49 41 2071 end
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input byte month int(UnitedNationsSustainableDevel Volkswagenemissionsscandal) -2 62 49 -1 42 41 0 228 2071 end
What I am hoping to achieve is a data set which looks like
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input float media str45 event float month 62 "United Nations Sustainable Development Summit" -2 42 "United Nations Sustainable Development Summit" -1 228 "United Nations Sustainable Development Summit" 0 49 "Volkswagen emissions scandal" -2 41 "Volkswagen emissions scandal" -1 2071 "Volkswagen emissions scandal" 0 end
Code:
twoway (line media month), by(event)
0 Response to how to graph from excel import which has numbers as variable names
Post a Comment