Announcement

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

  • Wrong parentheses for graph code

    Hi everyone,

    I intent to add my calculated confidence intervals to my graph:

    This is the code for the initial graph.

    Code:
    graph twoway (connected systolicdifference bpweeks) if inrange(bpweeks,20,40), by (ETHNICITY)

    I intended to add the confidence interval to the graph with this code but the parenthesis seems to be wrong . Could you help me identify where I went wrong.


    Code:
    graph twoway (connected systolicdifference bpweeks) if inrange(bpweeks,20,40), by (ETHNICITY)
    (rcap upperboundsofci lowerboundsofci bpweeks if inrange(bpweeks,20,40),by (EHTNICITY))

    Thank you very much

  • #2
    You don't give a data example or error message.

    There seem to be at least two problems, one that your if qualifier is placed wrongly in one case, and the other in spelling a variable name.

    I am not comfortable with the
    () notation for superimposing graph commands, so I will use the || notation, which I find easier to read.

    You could repeat
    by(ETHNICITY) but that is not needed.

    This should get you closer.

    Code:
      
     graph twoway connected systolicdifference bpweeks if inrange(bpweeks,20,40), by(ETHNICITY) ||  rcap upperboundsofci lowerboundsofci bpweeks if inrange(bpweeks,20,40)


    Comment


    • #3
      Thank you very much removing using the | I notion worked.

      Comment

      Working...
      X