Announcement

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

  • #16
    Thanks, Andrew. I don't think abbreviated depvar names will affect what I am doing. I just tried it and it seems to work fine. I'll try to break it...

    Code:
    sysuse auto
    logit for mp weight turn
    
    local wanted= ustrregexra(ustrregexra("`e(cmdline)'", "(\b`e(cmd)'\b|\b`e(depvar)'\b)", ""), "^(.+?)(\bif\b|\bin\b|\,)(.*)", "$1")
    di "`wanted'"
    result:
    Code:
     for mp weight turn

    Comment


    • #17
      Originally posted by Ariel Linden View Post

      Code:
      for mp weight turn
      Abbreviated RHS variables are not an issue. In your example, "for" or "foreign", the outcome, does not drop out. Unless you want to keep it. If you want to keep only the RHS variables, I would suggest:

      Code:
      sysuse auto, clear
      logit for mp weight turn
      local wanted= ustrregexra(ustrregexra("`e(cmdline)'", "(\b`e(cmd)'\b|\b`=word("`e(cmdline)'", 2)'\b)", ""), "^(.+?)(\bif\b|\bin\b|\,)(.*)", "$1")
      di "`wanted'"
      Note that

      Res.:

      Code:
      . local wanted= ustrregexra(ustrregexra("`e(cmdline)'", "(\b`e(cmd)'\b|\b`=word("`e(cmdline)'", 2)'\b)", ""), "^(.+?)(\bif\b|\bin\b|\
      > ,)(.*)", "$1")
      
      . 
      . di "`wanted'"
        mp weight turn

      Comment


      • #18
        Ahh, I see it now! Thank you for this, Andrew!

        Comment

        Working...
        X