Stata - How to use asdoc to make tables

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024
  • Welcome to my classroom!
    This video is part of my Stata series. A series where I help you learn how to use Stata. In this video, we look at how to use the asdoc command to create nice tables for descriptive statistics.
    Note: What I show here is my take on the topic. I would be happy to receive comments!
    Useful links:
    ►Twitch: / steffens_classroom
    ►Twitter: / steff5001
    ►Workpage: www.rug.nl/sta...
    ►Subscribe: cutt.ly/Qfu9cmV

Комментарии • 29

  • @TheSaharcom
    @TheSaharcom Год назад +1

    Thank you so much. Your videos are very helpful!

  • @user-hm7uu3kr1c
    @user-hm7uu3kr1c Год назад +1

    Thank you very much for the video! I want to use asdoc to create a summary table for mainly categorical variables, and to display the distinct categories, using "i.var" in the varlist. This works perfectly, yet when I want to use the variable labels with "label" this won't work. If I refrain from using the "i.var"-notation, the "label"-command works. Do you have any idea how I can combine both?

    • @SteffensClassroom
      @SteffensClassroom  Год назад

      Morning! Thank you for the comment.
      I took a look at this, and couldn't find much about it at the first glance. Two things come to mind.
      1) I am sure that you are aware of the work around, by splitting the categorical variable up into dummies. This can be done by for instance writing; tab var, gen(new_var). However, this does not solve it for the i.var issue that you want, but is more of a simple work-around.
      2) You could avoid the label option all together, if you changed the value labels. Look at this example:
      sysuse nlsw88, clear
      asdoc sum ibn.industry i.race wage, replace abb( . )
      Here you get a table which should look the way you like it to. Notice how the variables industry and race are set when you look at them in the data viewer.
      (The ibn. factor-variable operator specifies that a categorical variable should be treated as if it has no base, or, in other words, that all levels of the categorical variable are to be included in the model. The abb( . ) is to avoid the command shortening the names of your variables in the output table).
      I hope this helps!

    • @user-hm7uu3kr1c
      @user-hm7uu3kr1c Год назад

      @@SteffensClassroom Hi Steffen, thank you very much! For now I will go with variant 1, thank you for the hint. In scenario 2, I still have the variable name, not label, in the table, which I would like to avoid. Thank you again for responding so quickly!

    • @SteffensClassroom
      @SteffensClassroom  Год назад

      @@user-hm7uu3kr1c Hi again! If I understand correctly, for 2) you should try and construct the variable in the same way as in that example dataset I showed in my previous comment. I believe they are called value labels.

  • @RapMasterish
    @RapMasterish Год назад +1

    This is very helpful thank you! Is there any (asdoc) command that can make a table where both the descriptive statistics and correlation coefficients are shown in 1 table like in published articles? I couldn't find anything regarding this after using the help asdoc command...

    • @SteffensClassroom
      @SteffensClassroom  Год назад

      Hi!
      So far, I have unfortunately not found this with asdoc.

    • @RapMasterish
      @RapMasterish Год назад

      @@SteffensClassroom I expected that. Do you know of any other commands that are able to make 1 table? I’ve only found commands who will create them separately :/

    • @SteffensClassroom
      @SteffensClassroom  Год назад +1

      @@RapMasterish I only have experience with asdoc, estout and outreg2. However, there should also be a new teable command that could be useful.

    • @RapMasterish
      @RapMasterish Год назад +1

      @@SteffensClassroom Actually I managed to find a command that does what I want. It's the "mkcorr" command. :) Thanks again for making these useful Stata videos

  • @Asidders
    @Asidders Год назад +1

    I wonder how you get it where to place the files it creates. For me it chose the computer's default Documents folder, which I never use.

    • @SteffensClassroom
      @SteffensClassroom  Год назад +1

      Hi!
      You can set the current directory using the cd command :) There is a video on that on the Learning Stata playlist.

    • @Asidders
      @Asidders Год назад +1

      @@SteffensClassroom Oh, thanks, I didn't know that 'cd' changed the output folder for 'asdoc' as well. I thought I'd set it initially with the loading of the do-file. But I see it's working now. Thank you!

  • @sofyanbou7910
    @sofyanbou7910 2 года назад +2

    How can you install asdoc? On my desktop it is not installed

    • @SteffensClassroom
      @SteffensClassroom  2 года назад +1

      Hello Sofyan
      You can install it by writing: ssc install asdoc
      The ssc install command is the general command used for installing packages.

    • @sofyanbou7910
      @sofyanbou7910 2 года назад +1

      @@SteffensClassroom super thanks a lot I really appreciate your videos

    • @SteffensClassroom
      @SteffensClassroom  2 года назад

      @@sofyanbou7910 Thank you very much! If you have any suggestions for additional topics I can cover lmk :)

  • @paolo4401
    @paolo4401 11 месяцев назад +1

    Thank a lot! anyway,, does it display categorical variables with central tendency number and percentage? di I have to specify the nature of categorical variable by writing i. before the name?

    • @SteffensClassroom
      @SteffensClassroom  11 месяцев назад

      Hi!
      Do you mean a presentation like in this example?
      sysuse nlsw88.dta
      asdoc tab race married
      You will se here that the i. prefix is not needed.

    • @paolo4401
      @paolo4401 11 месяцев назад +1

      ook, thank you. the point is: is it possible to mix asdoc sum and asdoc tab and in order to have an automatically (without having to tell system which variable to tab cause it's categorical and viceversa for sum) set up table?

    • @SteffensClassroom
      @SteffensClassroom  11 месяцев назад

      @@paolo4401 Ah I see what you mean.
      I am actually uncertain if this is possible with asdoc. I haven't tried it out yet.

    • @paolo4401
      @paolo4401 11 месяцев назад +1

      and in general with STATA is it possible? I can't do it by following tables of frequencies etc.. @@SteffensClassroom

    • @SteffensClassroom
      @SteffensClassroom  11 месяцев назад

      @@paolo4401 I will need to look into a bit more. I have seen it done with asdocx, but there should be another way :)

  • @bartruempol7686
    @bartruempol7686 3 года назад +1

    Hi Steffen, once again, thanks for your video! I have one question regarding summarizing/tabulating large panel data (that has been made long). Because my data is long now, it thinks that one company with 30 monthly stock returns now counts as 30 observations if I use tab. Do you know how to avoid this? Or should I just tab and make the descriptive table before reshaping my data?

    • @bartruempol7686
      @bartruempol7686 3 года назад +1

      I want to put the countries of the firms in a table. Country is a string variable so sum doesn't work (for me at least)

    • @SteffensClassroom
      @SteffensClassroom  3 года назад

      You can do that, but in this case, you may want to use the xtsum command, which is more suitable for panel.
      Alternatively, you can also combine sum/tab with a 'by' command in order to create summary statistics per company.
      Wrt the asdoc command, you may want to check section 2.4 in the help file. I think that could help.
      Just my first thoughts. Hope this helps,

    • @SteffensClassroom
      @SteffensClassroom  3 года назад

      And referring to the second part of your command. You can generate country variable that is numeric by using encode.

    • @bartruempol7686
      @bartruempol7686 3 года назад +1

      @@SteffensClassroom It worked, thanks a lot!

    • @SteffensClassroom
      @SteffensClassroom  3 года назад

      Fantastic! Happy to hear it worked out :)