Announcement

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

  • Ambigious tempfile error

    Colleagues,

    I'm importaing some data that I would like to store some data via the tempfile in order to merge with the master data set that I'm working on. The extract of the code is available below:

    Code:
    /* Source the postcode latitude and longitude data */
    preserve
    copy "http://www.freemaptools.com/download/full-postcodes/postcodes.zip" ///
        postcodes.zip, replace
    unzipfile postcodes.zip, replace
    import delimited using "postcodes.csv", clear varnames(1)
    clonevar PostalCode = postcode
    tempfile "`temp2'"
    save "`temp2'"
    restore
    merge m:1 PostalCode using "`temp2'", keepusing(latitude longitude) ///
        generate(mrg_pclatlon) keep(match)
    As illustrated above Stata returns an error when attempting to process the tempfile command:

    Code:
    . /* Source the postcode latitude and longitude data */
    . preserve
    
    . copy "http://www.freemaptools.com/download/full-postcodes/postcodes.zip" ///
    >     postcodes.zip, replace
    
    . unzipfile postcodes.zip, replace
       inflating: postcodes.csv
    successfully unzipped postcodes.zip to current directory
    
    . import delimited using "postcodes.csv", clear varnames(1)
    (4 vars, 1703528 obs)
    
    . clonevar PostalCode = postcode
    
    . tempfile "`temp2'"
    _" invalid name
    r(198);
    
    end of do-file

    Naturally, it should be:
    Code:
    tempfile temp2
    save "`temp2'"
    I would delete this post but this option does not appear to be available.
    Last edited by Konrad Zdeb; 09 Sep 2014, 07:08. Reason: Error.
    Kind regards,
    Konrad
    Version: Stata/IC 13.1
Working...
X