Announcement

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

  • missing a bracket in code for twoway

    I keep getting the error ) required

    Code:
    twoway (kdensity totalscore if treatment ==1 & _weight!=., bwidth(10)) (kdensity totalscore if treatment ==0 & _weight!=., bwidth(10)) legend(order(1 "Treatment" 2 "Control") ring(0) cols(1) pos(1)) ylabel(,angle(h) format(%3.1f)) title("Density") xtitle("Score")
    Can you spot the error?

  • #2
    I didn't spot the error but I may have removed it.


    Code:
    twoway kdensity totalscore if treatment ==1 & _weight!=., bwidth(10) ///
    || kdensity totalscore if treatment ==0 & _weight!=., bwidth(10)        ///
    legend(order(1 "Treatment" 2 "Control") ring(0) cols(1) pos(1))      ///
    ylabel(,angle(h) format(%3.1f)) title("Density") xtitle("Score")
    Personal taste : I dislike the () notation for different commands. There are quite enough () already!

    Strong suggestion : When a command gets this complicated, use a do-file if you aren't doing so already. Split any long command into several lines.

    Comment


    • #3
      thanks for your suggesstion yes, separting out with || makes more sense

      Comment

      Working...
      X