Announcement

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

  • Trouble with -combine graph- command in do file

    I'm stumped by a problem I'm having in a relatively simple do file. I create and save to disc two histograms in the do file and then I try to combine with the command:
    - graph combine graph1.gph graph2.gph -

    When the do file hits this command I get the error message - variable combine not found -
    Meanwhile, after the do file has coughed up the error and stopped I can enter manually on the command line the same command, - graph combine graph1.gph graph2.gph - and I get the two saved graphs displayed as expected.

    I'm flummoxed as to what is going on with the - variable combine not found - error message and why my - graph combine - command won't work within the do file, but works perfectly fine post-do-file execution. I've set the trace on to see if I can figure out what's happening, but this doesn't reveal any helpful information. Anyone have any ideas?

  • #2
    Welcome to Statalist, John.

    We can better help you if we know precisely what commands you ran. Please review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. See especially sections 9-12 on how to best pose your question. It's particularly helpful to copy commands and output from your Stata Results window and paste them into your Statalist post using CODE delimiters, and to use the dataex command to provide sample data, as described in section 12 of the FAQ.

    In the absence of specifics about your commands, I attempted to reproduce your problem using a standard dataset included in the Stata distribution. It worked as expected. You might want to see if running this code works for you. If it does, think about how this code differs from yours. Add more of those differences to this program until it fails in the same way your real code fails.

    Code:
    sysuse auto, clear
    histogram weight, bin(5)
    graph save graph1.gph, replace
    histogram length, bin(5)
    graph save graph2.gph, replace
    graph combine graph1.gph graph2.gph

    Comment


    • #3
      William gives excellent advice as always. My own wild guess is that a version statement such as

      Code:
      version 7 
      appears earlier in the do file. Then the previous syntax of graph would obtain, for which see

      Code:
      help graph7
      in any version later than 7.

      Comment


      • #4
        William and Nick...thanks for the responses, and I'll follow William's lead on checking how to best post. As it turns out, Nick had it correct in that it was a version control issue. This was an old do-file that I wrote several years ago, the purpose of which is to allow my intro stats students to generate empirical sampling distributions based on random draws from different underlying distributions. In any case, when I commented out the first line - version 5.0 - (yes that old!) the program ran perfectly. Thanks again.

        Comment

        Working...
        X