Announcement

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

  • ytitle "unrecognized"

    Hi all,

    I've been trying to replicate a figure from code I got from the authors of a paper. When I run the code

    Code:
    graph twoway line guestwork year, lcolor(black) c(stairstep) yaxis(1) ylabel(0(250000)500000, format(%9.0fc) axis(1)) ///
                    ytitle("Total {it:bracero} arrivals", margin(medium) axis(1)) ///
                    || line apprehensions year, lcolor(black) c(stairstep) lpattern(shortdash) yaxis(2) ylabel(#3, format(%9.0fc) axis(2)) ///
                    ytitle("Apprehensions of Mexicans", margin(medium) axis(2)) ///
                    xtitle("Year", margin(medium)) plotregion(lcolor(none)) scheme(s1color) aspect(.6) ///
                    legend(label (1 "{it:Bracero} arrivals, US total (left axis)") label(2 "Apprehensions (right axis)") cols(1) region(lcolor(none))) ///
                    xline(1964.85, lcolor(black) lpattern(dot) l width(thin)) xline(1962.3, lcolor(black) lpattern(dot) lwidth(thin))
    I get an error that ytitle is unrecognized. I'm having a bit of trouble locating where the error in the code lies.
    The data looks like this

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input int year long(guestwork apprehensions)
    1942   4203   10613
    1943  52098   16154
    1944  62170   39449
    1945 120000   80760
    1946  82000  116320
    1947  55000  214543
    1948  35345  192779
    1949 107000  288253
    1950  67500  468339
    1951 192000  509040
    1952 197100  528815
    1953 201380  835311
    1954 309033 1022267
    1955 398650  221674
    1956 445197   62625
    1957 436049   38822
    1958 432857   32556
    1959 437643   25270
    1960 315846   22687
    1961 291420   23109
    1962 194978   23358
    1963 186865   31910
    1964 177736   35146
    1965  20286   44161
    1966   8647   71233
    1967   7703   96845
    1968      .  113304
    1969      .  159376
    1970      .  219254
    1971      .  290152
    1972      .  355099
    1973      .  480588
    1974      .  616630
    1975      .  579448
    1976      .  678356
    1977      .  792613
    1978      .  841525
    1979      .  866761
    1980      .  734219
    end

  • #2
    Try
    Code:
    graph twoway line guestwork year, lcolor(black) c(stairstep) yaxis(1) ylabel(0(250000)500000, format(%9.0fc) axis(1)) ///
     ytitle("Total {it:bracero} arrivals", margin(medium) axis(1)) ///
    || line apprehensions year, lcolor(black) c(stairstep) lpattern(shortdash) yaxis(2) ylabel(#3, format(%9.0fc) axis(2)) ///
    ytitle("Apprehensions of Mexicans", margin(medium) axis(2)) ///
    xtitle("Year", margin(medium)) plotregion(lcolor(none)) scheme(s1color) aspect(.6) ///
    legend(label (1 "{it:Bracero} arrivals, US total (left axis)") label(2 "Apprehensions (right axis)") cols(1) region(lcolor(none))) ///
     xline(1964.85, lcolor(black) lpattern(dot)  lwidth(thin)) xline(1962.3, lcolor(black) lpattern(dot) lwidth(thin))
    It looks like you had a space between "l" and "width".
    Last edited by Justin Niakamal; 11 Jan 2019, 16:11.

    Comment


    • #3
      Hi,

      I ran the code you suggested but Stata complained that "option / not allowed" and that "| is not a valid command name"

      Comment


      • #4
        I'm not sure what the issue is. I am able to run the code and produce the output in the attachment.
        Attached Files

        Comment


        • #5
          the code in #2 will not work if you attempt to use it interactively; it is meant to be used as a do file; if you want to run it interacdtively, you must delete all the "///"'s so Stata will realize it is all one command

          Comment


          • #6
            Hi Rich,

            I understand the issue now.

            Thank you

            Comment

            Working...
            X