Announcement

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

  • Display _dup(#) with blank space between each element

    Dear Stata users,

    I have a question that cannot work around. I want to display say 20 times of symbol "L", and I also want that there're blank spaces between each L. The result will be "L L L L L L L L ...". However, the simple code below cannot achieve the result:
    Code:
    display _dup(20) "L"

  • #2
    A simple solution is inserting a blank space after L, but I want to know if there's other solutions that resort to -display- per se:
    Code:
    display _dup(20) "L "

    Comment


    • #3
      Code:
      . di 20*"L "
      L L L L L L L L L L L L L L L L L L L L

      Comment


      • #4
        OK, thank you Nick. This
        Code:
        display _dup(20) "L"
        is actually a piece of code in your command -barplot- (SSC, Distribution-Date: 19991029).
        Code:
        local connect : di  _dup(20) "L"
        local symbol : di _dup(20) "i"
        
        if "`by'" != "" { local byby "by(`by')" }
        
        gra `varlist', c(`connect') sy(`symbol') `xlabel' `options' `byby'
        In Stata version 8 and later, when we substitute "twoway connected" for "graph":
        Code:
        version 8: twoway connected `varlist', connect(`connect') msymbol(`symbol') `options' `byby'
        Stata will give result:
        Code:
        . barplot price mpg
        (note:  named style iiiiiiiiiiiiiiiiiiii not found in class symbol, default attributes used)
        (note:  named style LLLLLLLLLLLLLLLLLLLL not found in class connectstyle, default attributes used)
        Now the quesiton has resolved. Thank you.

        Comment


        • #5
          Good that your question is resolved. As some footnotes:

          The help file help njc_stuff available from SSC declares barplot from SSC to be obsolete.

          The syntax in #3 was not available in 1999.

          Similarly the syntax of what is now called graph7 doesn't map one to one onto that of graph from version 8 onwards.

          Comment


          • #6
            Yes, some if not many commands are obsoleted, but hope the ideas behind these commands still be useful.

            Comment


            • #7
              First of all, I try not to make claims about commands being obsolete unless they're mine (fair comment, surely) or it's objectively true.

              Some old commands of mine remain on SSC because just possibly someone is running an ancient script that uses them. It's hard to know when the probability of that happening is precisely zero.

              But generally it is a waste of everyone's time to look at obsolete commands; by definition there's now a better way to do the same thing(s).

              To complete the circle, that is one reason why njc_stuff is there on SSC to give information on my stuff that is public, including what is now of no use or interest. It's not always bang up-to-date, but roughly speaking it gets updated about twice a year,

              Comment

              Working...
              X