Announcement

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

  • Postfile does not work after user written command

    Hi all,

    For some reason Stata does not find my postfile after a user written command is executed. The really weird thing is that the first time I execute my do-file (let’s call it do-file A) the code does NOT run and an error message saying, “post postname not found” appears. However, if I execute do-file A again immediately after the first time, the code DOES run. So far, not big deal. The problem however arises when do-file A is called or used by another do-file (let’s call it do-file B). No matter how many times I execute do-file B, it will never run and I always get the same error.
    Do-file A is something like this:

    Code:
    drop _all
    postfile f str15(country year text) using file, replace
    local countries "pry hnd"
    local years "2005 2007"
     
    foreach country of local countries {
                foreach year of local years {
                            user_command [syntax]
                            post f ("`country'") ("`year'") ("this is a test")
                }
    }
     
    postclose f
    use file, clear
    exit
    I already checked the user written command (user_command.ado) and it does not have any "clear" or “clear all”, it only has “drop _all” and “preserve.” Also, neither do-file A or B has any “clear” or “clear all.”

    Any help would be highly appreciated.
    Thank you in advance,

    Pablo
    Last edited by Pablo Bonilla; 30 Sep 2014, 18:49.
    Best,
    Pablo Bonilla

  • #2
    Duplicate post.

    Comment

    Working...
    X