Announcement

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

  • Local macro

    Dear All,

    I am looking for a reference in Stata documentation where the local macro * (star) is defined.

    Thank you, Sergiy

  • #2
    Under what circumstances have you encountered the local macro * (star)?

    Comment


    • #3
      Code:
      help syntax##description_of_options

      Comment


      • #4
        Rafal,

        I think the reference you provided only explains the relationship between [*] and `options' (standard and documented feature of the syntax command), while what I am looking for is a relationship between X and `*' similarly explained (where X is I don't know what).

        I believe `*' is probably something old, perhaps dating to the era when arguments were referred to by `1' ,`2' etc, and could be a collective way of denoting them?? Perhaps, similar to `0', but I can't find any formal confirmation of this anywhere.

        Thank you, Sergiy

        Comment


        • #5
          William, it is almost in every StataCorp-supplied ado file. But they are rather long.

          The following is a rather trivial example that strangely yields not empty result in the last output:

          Code:
          clear all
          
          program define foobar
             display `"`0'"'
             display `"`1'"'
             display `"`2'"'
             display `"`*'"'   
           end
           
           foobar first(x) second(y)

          Comment


          • #6
            `0' contains exactly what the user typed, including odd spacing, quotation marks, etc.; * contains what the user typed but odd spacing, quotation marks, etc., are removed; see [U] User's Guide, section 18.4.
            Code:
            . foobar first(x)   second(y)  
            first(x)   second(y)
            first(x)
            second(y)
            first(x) second(y)
            Last edited by Rafal Raciborski (StataCorp); 19 Jul 2018, 15:18.

            Comment


            • #7
              The results of
              Code:
              clear all
              
              program define foobar
                 display `"`0'"'
                 display `"`1'"'
                 display `"`2'"'
                 display `"`*'"'   
                 macro list _all
              end
               
              foobar first(x) second(y)
              run after a relaunch of Stata
              Code:
              . do "/var/folders/xr/lm5ccr996k7dspxs35yqzyt80000gp/T//SD53419.000000"
              
              . clear all
              
              . 
              . program define foobar
                1.    display `"`0'"'
                2.    display `"`1'"'
                3.    display `"`2'"'
                4.    display `"`*'"'   
                5.    macro list _all
                6. end
              
              .  
              . foobar first(x) second(y)
              first(x) second(y)
              first(x)
              second(y)
              first(x) second(y)
              S_level:        95
              F1:             help advice;
              F2:             describe;
              F7:             save
              F8:             use
              S_ADO:          BASE;SITE;.;PERSONAL;PLUS;OLDPLACE
              S_StataSE:      SE
              S_FLAVOR:       Intercooled
              S_OS:           MacOSX
              S_OSDTL:        10.13.6
              S_MACH:         Macintosh (Intel 64-bit)
              _2:             second(y)
              _1:             first(x)
              _0:             first(x) second(y)
              
              . 
              end of do-file
              suggest that `*' is not fully a local macro, but rather a deprecated version of what is now provided by `0', which is common in almost every StataCorp-supplied ado file that does not include `*' (which is, for example, 43 of the 51 ado files in the ado/base/a directory on my system).

              But the post #4 shows you expected that. Perhaps you could have included the example from post #5 and the elaboration is post #4 in your original post to provide the necessary context to your question.

              Comment


              • #8
                My post #7 crossed with post #6, which reminds us that unfortunately there is a certain amount of arcane information to be found only in the Stata User's Guide rather than the variously titled "Reference" manuals.

                Here's an example of the difference between the two.
                Code:
                . program define foobar
                . program define foobar
                  1.    display `"`0'"'
                  2.    display `"`*'"'   
                  3. end
                
                .  
                . foobar first( x )    "second(y)"
                first( x )    "second(y)"
                first( x ) second(y)
                
                .

                Comment


                • #9
                  Rafal, William, thank you very much for explaining. Reference to section 18.4 of the User's Guide is exactly what I was looking for. Thank you, Sergiy

                  Comment

                  Working...
                  X