Announcement

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

  • ATUS WB 2013 file syntax error

    Hi all,

    I am trying to use the ATUS (American Time Use Survey) Well-being dataset. The ATUS site provides a do file for me to run, however I keep getting a syntax error when I try to run it.

    Code:
    . do "C:\Users\heatf\Downloads\wbact_2013\wbact_2013.do "
    
    . #delimit ;
    delimiter now ;
    .  cd "C:\Users\heatf\Downloads\wbact_2013"
    >  
    > insheet tucaseid tuactivity_n wufnactwt wufnactwtc wuhapord wuhappy wuinteract
    > wumeaning wupain wupnord wusad wusadord wustress wustrord wutired wutrdord usin
    > g wbact_2013.dat, names comma
    >
    > *Labeling
    >  
    > label variable tuactivity_n "Activity line number";
    invalid syntax
    r(198);
    I have no idea where the syntax error is, as I am a newbie to Stata. I would appreciate some help on this matter.

    Thanks,

    Benjamin Vu

  • #2
    The semicolon

    Comment


    • #3
      Dear Jared,

      Thank you so much for the quick response. This does resolve my issue, however now I have a question: Why is it that this file can be ran without the semicolon, yet the block of code below can run whilst using semicolons?

      Code:
      #delimit ;
       
      * Edit the import statement to reference the data file on your computer.;
       
      import delimited
      tucaseid
      tuactivity_n
      tewhere
      trtcctot_ln
      trtcc_ln
      trtcoc_ln
      trtec_ln
      trthh_ln
      trtnohh_ln
      trtohh_ln
      trtonhh_ln
      trto_ln
      tuactdur
      tuactdur24
      tucc5
      tucc5b
      tucc7
      tucc8
      tucumdur
      tucumdur24
      tudurstop
      tuec24
      tustarttim
      tustoptime
      tutier1code
      tutier2code
      tutier3code
      trcode
      trtier2
      txwhere
       using atusact_2020.dat, stringcols(1) ;
       
      label variable tewhere "Edited: where were you during the activity?";
      Thanks,

      Benjamin Vu

      Comment


      • #4
        Let me preface my comments a moment. I'm 24. I'll be 25 May 17th. I've used Stata for 8 years.

        I say this to say, I am not old enough to remember the origins of the delimit command. As it stands, it does what you do here. Breaks up a long command into hipotecar many lines you'd like.


        But, I didn't grow up with C or C+ or whatever language started this trend. whenever you end use the delimiter command, you ostensibly must declare it every time? I think? I don't know since I never use it. What I do, for my own work, is something like
        Code:
        sc price weight, ///
        scheme(gg_tableau) ///  a user written scheme
        xli(2500) /// reference line
        yti("the y axis") // and we finish with this
        Because it means that I can break up my commands into multiple lines without needing to use or refer to or keep track of a goofy semicolon or whatever the notation that is used for the delimit command.

        Perhaps I show my age, but here you use the delimiter correctly, I think, but my advice to you is to not use the delimiter command and just use three slashes to break up your commands.

        Comment

        Working...
        X