Announcement

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

  • program error: code follows on the same line as open brace [Need Help]

    Click image for larger version

Name:	Screenshot 2022-05-22 at 20.25.31.png
Views:	1
Size:	99.9 KB
ID:	1665826
    Hello, I am following these steps (https://www.techtips.surveydesign.co...0off%20command.) to attempt to produce multiple graphs at once, however, I keep getting the following output, how do I fix this? Really appreciate any help.

  • #2
    The error message is self-explanatory. The code that you have put between braces on the same line as the -foreach- command has to be on a separate line. You will also need to place the -vioplot- and -graph export- commands on separate lines. Stata requires all new commands to begin on a new line.
    Code:
    foreach var in Sublclass Group Level {
        vioplot ATF4Targetgenes `var'
        graph export ATF4Targetgenes_`var'.png
    }
    Added: In the future, rather than showing screenshots from the Results window, please copy/paste here into the Forum editor between code delimiters. That way others will be able to copy/paste from your post into their solutions instead of having to type everything over from scratch. If you are not familiar with code delimiters, please consult Forum FAQ #12.

    Comment


    • #3
      That’s four lines of code not one, starting

      Code:
      foreach 
      vioplot 
      graph
      }

      Comment

      Working...
      X