6/14/2023 0 Comments Amadeus pro wordpressIn essence: no options were changed for the databases. These changes mainly concern the search options for databases (step 2) and the selection options (step 3). This week some major changes were implemented in the Wharton Research Data Services (WRDS) platform. This example applies to Stata editions 13 and 14.įiled under: Amadeus, Bankscope, Data management, Datastream, Stata | Tagged: Stata | Comments Off on Changing Datastream data & Stata do file that shows examples of all the commands. do file that contains all the commands in sequence and this allows you to reuse it in similar situations for similar downloads. The command rename can be used to rename variables.The command order can be used to reorder data and put the UID variable in the first column.Remove observations without data using, for example: drop if mi(Y).Use the drop command to remove unnecessary columns.Use the destring command to as follows: destring Y, replace forceĭestring also removes any values that were not numbers (but text) and replaces them with an empty cell (.) because of the option force (this can be dangerous if the content of a cell is a combination of a numerical value and text). One thing is necessary: for Stata the numerical data is still a (text) string and now need to be changed. The final step is creating the unique ID combination UID with the command: gen UID = Compan圜ode+yearĨ) Now there are a few steps left to finalize the Datastream data but not all of it is necessary. To do this we need to turn the years back from numerical values into strings using the tostring command: tostring year, replace. When you use the command browse again you see the result of the data change:ħ) We now need to create a unique ID combination to later merge the data. The ID for each company also needs te be repeated for the years of all observations. In a nutshell this tells Stata that the years for the columns need to be repeated for the observations/records and can be found in the names of the variables. If you need more explanation on how it works you can type the command help reshape and Stata will provide much information on how to use the command. This command has many options and allows you to rework tables. To later merge data the company ID’s need to be combined with the yearsĦ) We now transpose the data using the command Reshape.The data is not yet formatted as we need it: the numerical data are now strings (red) and need to be changed later.Example:ĥ) When we look at the data with the browse command you see that the data looks basically the same as how it appeared in Excel: The firstrow option tells Stata that this row has the variable names and lables. In this case we prepared the Datastream file nicely and can therefore use the command: import excel using DS-Prepared.xlsx, firstrow If necessary use copy > paste special > ValuesĤ) Next we start up Stata and get the file. Example:ģ) Now save the Datastream Excel file without these formulas. The dollar signs fix certain cells or a row (or column). It can be done smartly using a specific cell for the header and then combining it with the original year above each column as follows with the formula =($A$1&(B$1)). Example:Ģ) Next you need to create column year headers that start with a text character and then the year of the column (this step is important for Stata later). MID() allows you to get part of the contents back from a Cell. This can be done using the function MID(Cell,Start,Number) (= in Dutch versions of Excel: the Deel() function). The following changes need to be made in Excel:ġ) Get the ID back from the download without the extra Datastream codes. Example screenshot original download from Datastream (transposed): In the case of Datastream this has everything to do with the fact that Datastream does not repeat an ID for each year of data you download (unless using a Request Table search). Similar work can be done for other downloads from databases like Amadeus or Bankscope.įor downloads it can take a bit of work to change the data and rework it before Stata can be used to merge it with other data. In this blog post I will use the reshape command to change Datastream data as an example. It is similar to the transpose option that Microsoft Excel offers for quick changes. There are many commands available and one of them is very handy when it comes to changing data from columns to rows. This program can handle a lot of data and uses commands to edit data or analyse it. The past few weeks I have been learning about and working with Stata. Warning: WRDS and Two-Factor Authentication.
0 Comments
Leave a Reply. |