0:00
Welcome to the Data Hall YouTube channel
0:02
In this video, we are going to talk about how do we export status result to an Excel or an MS Word file
0:11
So we can execute certain ysis, we can perform certain ysis, but the important task is how do we export those results in a publication style tables
0:21
Now, we have already covered multiple commands on our channel. We do have videos on them
0:26
There is a video on Outrag, AS Docs, etc. But this specific series is going to cover this EST out command, right
0:38
It is rather a package of commands. And we are going to cover regression ysis, summary statistics
0:47
mean comparison, one-way tabulation, and two-way tabulation. So we are going to see how each of this ysis can be done
0:56
and its results can be exported to Excel or MS Word file
1:01
So to install this command, we are going to use SSC install EST out
1:06
but I have already installed it, so I'm not going to install it. So let's load our auto data
1:14
And in auto data, we have different cars, their price, mileage, their weight, length, etc
1:20
And whether that car is domestically produced or a foreign car. and we are going to start with regression results
1:29
So when we are working with the regression results, so if you look at EST out
1:35
let me just show you the help menu of EST out, and let me just give you some idea
1:42
So this EST out command contains some sub commands, right? There is EST tab, EST store, EST ad, EST
1:52
and all these commands perform certain functions. And this EST out is quite a detailed command, right
2:02
So when we are working with regression, we are going to be working with EST store
2:11
that is EST STO, and then EST tab. So these two commands are going to be used
2:18
This EST store is going to be used to store the estimates. in status memory and then this tab command is going to be used for two purposes
2:28
One is to display the results in our status window. I mean the way that it would be exported and the same outlook of the table would be displayed
2:41
in the data menu, in the data results window and that is quite unique to this command
2:48
The other commands do not do this. this thing is quite unique to this command
2:53
And then the same command can be used to save the estimates into an Excel or a word file
2:58
So let us get started. So we have this regression command. And if we execute this regression command
3:05
we know that it would perform this regression of price on mileage and length
3:12
So if we were to store the estimates, you would just use the EST store prefix
3:20
before this regression command light. So that would store the estimates and we would get this message in our status window
3:33
Now remember this EST store is used to store the estimates and EST tab is used to display the estimates
3:39
So we can use this EST tab and that would display the estimates
3:46
Now that is just the basic idea of how this this would look like
3:50
And we are going to cover different functions, different options that would enhance this capability
3:57
But I would just give you an overview of the whole process and then we would dive into each of these commands in detail
4:08
Again, let's just say if I were to execute another regression, this time instead of length, let's say we have weight
4:17
in our regression model. Now, the EST store can be used in two ways
4:25
One is to use it as a prefix, and that's second is, and I'll just say you are performing different regression commands
4:32
and you do not know which one you're going to store the results
4:37
So what you can do is perform different regression results, and then once you're done with that
4:41
you can use the EST store command afterwards. And now we can simply use EST store or we can also give the name to that store results
4:55
You know how it stored the result in EST1 and you can also see that over here But that is not a descriptive name And if you wanted a descriptive name we know that in this regression
5:08
we have used weight as an independent variable. So rather we should, you know, give it a descriptive name
5:15
It isn't necessarily that you would give the same name as the variable
5:19
but anything that would make you remember that. So the results had been stored
5:27
and if we do EST tab, we get both the results. The first one had mileage and length
5:36
and the second one had mileage and weight, right? We get the T-stats within the parenthesis
5:46
That is by default, and the nodes would also display that. And we also get the asterisk for each level of significance
5:54
Again, if you want it to let's do one more regression where we have both length and weight
6:01
and let's use that as a prefix. So we can use EST store command and we can use the name of that regression, how those
6:12
estimates would be stored even in the prefix, you know, way of storing the results
6:20
That will store the results. and if we do EST tab, we get the results
6:25
Now, we would get back to how these columns can be changed
6:29
and how we can have standard errors in parentheses, etc. But that would be discussed in a while
6:36
Let's just save these results. Now, if we wanted to save the results
6:41
we just, what we do is with the EST tab command, we just write using results.RFT
6:48
And this RFT is used if you wanted to save the results
6:52
in an MS Word file. If you wanted to save in an Excel file, then we would have to use the CSV
6:58
So let's execute this command. Let's open the data. Okay, so one mistake that I always do is that it should not be RFT rather, it should be RTF, right
7:14
So that was spelling mistake. Let's open this. and this is how the results would look like
7:23
We are going to perform certain formating with these, but in a while, right
7:30
We can also use CSV to save it in Excel, and this is how it would look like
7:40
If we wanted to save that in latex format, then we would use TX
7:45
Okay, so let's discuss further. options related to EST store and EST tab
7:52
Let's start with option with the EST store. First thing, we can look into all the stored results by using EST store, DIR, which stands for directory
8:04
And that would give us all these results that are stored. It would give us the command that was executed, the dependent variable name, how many
8:13
parameters we had, and the title of that. But we can change the title
8:18
later on. You can click over here and we get the estimated results, right? That is how do we look at
8:25
the stored results. If you wanted to drop a result that is stored, then we have their names over
8:32
here, right? So we can use EST store drop and then the name of that specific result that we want
8:42
to store and if we do EST store directory again, we can see that EST one has
8:48
had been dropped. That result had been dropped. And you can see these names are where these names coming from
8:54
These are coming from the name that we specified with the EST store while we were saving those results
9:02
We can specify multiple results. So if you were to drop weight and both
9:08
then we can use EST store, drop weight and both. Or we can drop all the results by using EST store clear
9:18
And that would drop all the results. So we do not get any results
9:23
We can also change the title. So let's just say, let's generate new results
9:30
Let's generate new regression models and stored their results because we have already deleted all of them
9:37
So we use the name of the stored estimates. We can specify the title
9:45
Remember this title is an option with the EST store command. So it would come as a after comma you know before the colon sign because this is so whatever options we are going to use related to EST store would come before the prefix and whatever options we are going to use with the regress command let us say robust etc that would come after the regression command with a comma
10:19
So let me execute this. The results had been stored and let me also execute the second where we have weight instead of length
10:27
and let's look at the results. Now, although we have provided this title over here
10:36
but it does not show the title when we do EST tab
10:40
and the reason is that by default, it would always display the dependent variable name
10:46
So one thing we need to do is we need to tell it not to display the dependent variable name
10:51
And once we do that, what would happen is that it would start
10:56
displaying the name of that that stored regression. The second thing is that we do not want
11:08
these numbers to be displayed over here. So we can use the no number option
11:13
and this number would be gone. Lastly, we want the label and that is where
11:18
this title would come in and the labels for the variables would be used instead of their name
11:26
So previously we were using the names of the variables and now with the label option we have
11:33
replaced the name with the labels and we have also used the titles over here
11:38
We can give custom titles if we didn't want it these titles
11:45
or we didn't want it to use the label option. What we can do is we can use the M titles option
11:53
So let's do EST tab comma M titles. and give the name of the column separated with the space
12:00
Remember to use inverted commas for the column names. So you can see how I'm not using labels or no dependent variable
12:11
I've just used this M titles and that would use the column names
12:19
M stand for model titles. I could have used no numbers or other functions
12:26
with that but I guess that's clear. I can also have this title with this table, right
12:36
And that would come over here. And remember whenever you want to
12:41
when you think that this table is ready to be exported, what you do is you just, let's just say
12:50
RTF, export the results and that would be exported in exactly the same fashion
12:56
that had been displayed over here. As you can see that we have the table title
13:02
we have the model coming from the M titles option. Okay, so we can also add notes over here
13:13
that let's just say we wanted to specify the source of the data
13:18
or we wanted to specify the details related to these variables. We can also remember once you save the results
13:26
You would have to, once you store the estimates, if you use the same name
13:35
So these are our results, these are the results that were stole this first column model X
13:42
Is the results which we used for the length when we had length variable
13:48
But let us say I have a different model where we have length, weight and repair variable
13:54
but I'm using the same name as I stored the results previously
13:58
If I do that, remember that Stata would replace the previous results stored with the name of length
14:09
So now you can see that those results had been replaced with the new results
14:14
So you can replace by using the same name. That's why names are more handy
14:21
We can do regression by group. the way we do it, so let's say we have this categorical variable
14:28
whether the car is produced domestically or in a foreign country, and we want to have different regressions based for different category of the car
14:40
whether that is a foreign car or domestic car. So we want to have a separate regression for domestic cars
14:45
and a separate regression for a foreign cars. So what we do is we use this bi-form, this name of the variable
14:53
categorical variable column then here we would use the estu store column and remember if we wanted to
15:01
use any options with the estu store you can do that over here regress and we have our regression and if you wanted to display the results we can use that Because we already had two columns over here two results over here and then we have added
15:19
the domestic and the form results over here. We have used this label and no dependent variable as discussed previously
15:28
So we can see the name of the labels using which we have stored
15:36
the results. Let's move to the options related to EST tab. Let's look at different results that we have. Remember, it's not necessary that we have to export all these results. If we want it just, you know, if we just do EST tab, that would show us all the results, right? All the for, for model. But if you were interested in just these two
16:06
two models, this length and the weight, then we can use those names in our EST tab and that would
16:13
just display and export those two results. Remember we can not have these parentheses with the
16:22
T test or we can use this bracket option instead of no parenthesis and that would give us brackets
16:32
instead of parenthesis. See how this T-test is not in absolute form
16:41
We can have this ABS option and that would give us the T-test in the absolute form
16:48
or we can use this not option and that would simply remove the T-tests
16:55
So the T-test had gone. Now for some generals we want the tables to be in wide
17:02
format so we want the coefficients and then the T test or standard error which
17:07
which our statistics you would want but the idea is that they would be in in
17:12
different columns in wide format similarly we can have standard errors instead of
17:18
T test whether that is in wide format or in long format we cannot have stars we
17:24
can use R square in our results we can not have observations number of observations
17:30
We can use labels instead of variable names, and we can use the adjusted R square
17:37
So this is how it would look like. We have labels, we have standard errors, R squared, adjusted R square, and we do not have
17:47
a number of observations. You can also have p value in parenthesis instead of standard errors
17:56
By default, it would always be a T value. we can use this beta option for standardized coefficients
18:04
We can also change the decimal points. So let's just say if we wanted to have this beta coefficients with two decimal points
18:15
By default, it would give us one decimal point, but let's just say if we wanted two decimal
18:22
points, then we can use this beta, within parenthesis, we can specify the number of decimal points
18:29
We can do that with each kind of statistics, with standard errors, with P, with confidence interval, or with the T value
18:38
They have their options of their own and you can specify them all in your EST tab command
18:44
So you can either save the results, right? And if the results are already saved, as we already have a file by the name of results
18:56
So we can replace that. And if we do not, let's just say if we re-execute this regression, this EST tab command
19:05
and trying to save it by the same name, it would give us an error saying that that file already exists
19:13
So what we can do is we can use this replace option
19:18
And what that would do is it would delete the previous file and replace it with the newer results
19:25
Or we can use this append option. And what that would do is instead of replacing the file, it would append this newer table along with this older table
19:39
So we already had this table. When we use the append option, we have appended a new table beneath the older one
19:48
And we can go on by adding as many tables as we want
19:53
So I hope this was useful. Do subscribe to this channel. Do hit the bell icon because in next video we are going to talk about other options or other ways that we can use this command to export the results of let's just say summary statistics mean comparison etc
20:13
So stay tuned to the channel