Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Wow, this is fantastic! Thank you so very, very (very) much for helping me with this, Nick. I seriously don't know what I would do without the Stata list forum. Thank you.

    Comment


    • #17
      I am so sorry. I just have one more question...

      If I would like to replace N with mean values to the left of the bars, is there a way to collect the mean values and decide the number of decimal points (i.e. format) when I collect the mean values?

      The code below collects the mean value of each variable, but I would like to reduce the number of decimal points to 1. I tried to incorporate a - format - command, but I did not succed.
      Code:
          gen detail2 = " ({it:m} = "+ string(mean) + ") "

      Comment


      • #18
        Code:
         
         string(mean, "%2.1f")
        See the help for string() to see that there is an optional second argument. string() is smart: you won't lose leading digits by specifying %2.1f: it just rounds as you want.

        Comment


        • #19
          Thank you! I did search for help on formatting, but I failed in my attempt. And my original code (which of course did not work) went something like this:
          (I do not put this in code delimitors, since it is incorrect)

          string(mean, format(%2.1f))

          But as usual, your code works just perfectly. I am currently reading through all of your precious code line by line, in order to get a better understanding what it is doing, and to enhance my knowledge of Stata. It functions as a great learning tool. ;-) Again, thank you!

          Comment

          Working...
          X