Forum Replies Created

Viewing 9 posts - 61 through 69 (of 69 total)
  • Author
    Posts
  • Attaullah Shah
    Keymaster
    Post count: 69

    You have to write the names of those variables. For example, in the following code, I am specifying three variables, ie. price, mpg, and rep78

    *Load auto dataset for our example
    sysuse auto, clear
    
    *Report summary statistics for only three variables
    asdoc sum price mpg rep78, replace
    Attaullah Shah
    Keymaster
    Post count: 69

    First, you need to install the fillmissing program. Then you can use use the bys prefix with the company id variable. See the following example.

    *To download  
     ssc install fillmissing
    
    *Create a dummy data for use in our example
    
    clear 
     input id price month year
            123 1 1 2000
            123 . 2 2000
            123 . 3 2000
            123 1 4 2000
            123 . 5 2000
            123 2 6 2000
            123 2 7 2000
            456 . 1 2000
            456 . 2 2000
            456 1.5 3 2000
            456 3 4 2000
            456 . 5 2000
            456 . 6 2000
            456 3 7 2000
     end
    
    *Create a monthly date in Stata format
    gen mdate = ym(year, month) 
    format mdate %tm 
     
    *Fill the missing values within each company ID, using the mdate as a sorting variable.
    bys id (mdate): fillmissing price, with(previous) 
    Attaullah Shah
    Keymaster
    Post count: 69

    If you want to create two groups of firms in each year, then something like the following will work:

    * For creating two groups of firms in each year, I am using astile. More on astile here

    ssc install astile, replace
    
    *Download example data
    webuse grunfeld, clear
    
    *Create two groups based on mvalue
    bys year: astile size = mvalue, nq(2)
    
    *Cross-sectional regression
    *For Cross-sectional regression, install asreg, more on asreg here
    
    ssc install asreg, replace
    
    *Yearly cross-sectional regression for each size group
    bys size year: asreg  invest mvalue kstock
    Attaullah Shah
    Keymaster
    Post count: 69

    I think you are referring to nested tables of asdoc. You can use the option rep(t) to report t-values instead of standard errors. See this example:

    sysuse auto
    asdoc reg mpg rep78 headroom trunk, nest rep(t) replace
    asdoc reg mpg rep78 headroom trunk, nest rep(t)

    reporting t-values in asdoc nest option

    Attaullah Shah
    Keymaster
    Post count: 69

    If you want to repeat the summary statistics by year, you can use the bysort prefix. see the following example,

    webuse grunfeld, clear
    bys year: asdoc sum, replace

    For your second query, you can use the save() option of asdoc. So assume that you have a directory in C:/results and you want to save the output to this directory. You would use the save option as shown below.

    webuse grunfeld, clear
    bys year: asdoc sum, replace save(C:/results/Myfile.doc)
    Attaullah Shah
    Keymaster
    Post count: 69

    You can use asdoc for writing multiple regression tables to the same document. asdoc can be downloaded from SSC and can be used with almost all Stata commands. Here is a short blog post that shows how asdoc can be used with any Stata command. You can also watch several YouTube videos that show the use of asdoc

    * Install asdoc

    ssc install asdoc, replace
    Please note that I am using the nest option of asdoc in the following example. There are two other options to report regression output, they are (1) detailed regressions, which is the default in asdoc (2) wide regressions, which can be invoked by using the option wide. You can see further details on these in the help file of asdoc

    asdoc reg price headroom, nest save(Regression) replace
    
    asdoc reg price headroom turn, nest save(Regression)

    * Please note that option append is optional in asdoc, without
    * option replace, all additional output is appended to the file

    * Now start a new table by using the option reset

    asdoc reg mpg price headroom, nest save(Regression) reset
    asdoc reg mpg price headroom turn, nest save(Regression)

    See the asdoc output

    Attaullah Shah
    Keymaster
    Post count: 69

    In version 2 of asdoc, I have included value labels with all tabulation commands, i.e. tabulate, tabulated2, tab1, tab2, etc. Thanks for your suggestion.
    The new version of asdoc can be installed from my site. Copy and paste the following line in Stata and press enter.
    net install asdoc, from(http://fintechprofessor.com) replace

    Please note that the above line has to be copied in full. After installation of the new version, then restart Stata.

    Please do remember to cite asdoc. To cite:
    In-text citation
    Tables were created using asdoc, a Stata program written by Shah (2018).

    Bibliography
    Shah, A. (2018). ASDOC: Stata module to create high-quality tables in MS Word from Stata output. Statistical Software Components S458466, Boston College Department of Economics.

    Attaullah Shah
    Keymaster
    Post count: 69

    Yes, asdoc can report OR and confidence intervals. When you wish to report odd ratios, just add option eform() to the command. And asdoc reports confidence intervals with the detailed regressions. For further details, you may like to read this blog post where I show how to report and suppress several regression statistics.

    Attaullah Shah
    Keymaster
    Post count: 69

    You can use the option reset.
    Option reset causes asdoc to make a new nested table, i.e. instead of appending to the existing nested table, option reset will start a new table in the existing file

    See this example:

    * load the auto data set

    sysuse auto

    *Make a nested table where the dependent variable is price and independent variables are mpg rep78

    asdoc reg price mpg rep78, nest replace

    * Add variable headroom and then nest with existing table

    asdoc reg price mpg rep78 headroom, nest

    * Add variable weight and then nest with existing table

    asdoc reg price mpg rep78 headroom weight, nest

    Add another table of regression in the same file
    This time our dependent variable is displacement. Please note that we shall use the option reset, which will start a new regression table in the file.

    asdoc reg displacement mpg rep78, nest reset
    
    asdoc reg displacement mpg rep78 headroom, nest
    
    asdoc reg displacement mpg rep78 headroom weight, nest
Viewing 9 posts - 61 through 69 (of 69 total)