Announcement

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

  • Understanding macro syntax

    I use a macro to define the URL for a dataset downloaded from Harvard Dataverse using copy:
    Code:
    local unvotingdata "https://dataverse.harvard.edu/api/access/datafile/2839238?format=original"
    copy `unvotingdata' "RawVotingdata.dta", replace
    This returns a "varlist not allowed" error, but if I enclose the call to the macro in double quotation marks, it works fine:
    Code:
    local unvotingdata "https://dataverse.harvard.edu/api/access/datafile/2839238?format=original"
    copy "`unvotingdata'" "RawVotingdata.dta", replace
    I copy other datasets from URLs input as macros without double quotation marks, so I'd appreciate an explanation for why Stata needs them here.

  • #2
    I believe it is the = character in the URL that causes this problem.

    Comment

    Working...
    X