Announcement

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

  • question about a r(101) error

    Dear all,

    I get an r(101) error while running the following code (the error is "factor variables and time-series operators not allowed
    r(101)) and the code seems to end at "save "$scrap/area_`time'.dta", replace", since I get a "file $scrap/area_`time'.dta, saved" line right before the error line.

    This error must be coming from the loop, as when I run the code by hand, directly writing "pre" instead of looping, the code seems to work, but I do not understand why that would be the case.
    Would you have any insight ? Many thanks!

    foreach time in pre post {
    use "$scrap/temp_delim_`time'.dta", clear
    merge m:1 census_code_2001 using "$scrap/temp_shrugid", keep(match) nogen
    *Aggregating area data at shrid level
    preserve
    keep shrid state_number_2001 census_code_2001 area_std_`time'
    duplicates drop
    drop census_code_2001
    collapse (sum) area_std_`time' , by(shrid state_number_2001)
    save "$scrap/area_`time'.dta", replace
    restore
    collapse (sum) area_intersect_`time', by(shrid state_number_2001 ac_unique_`time' ac_no_`time')

    }
    Last edited by Jean Dupont; 25 Nov 2019, 08:40.

  • #2
    I spotted the error I my code.
    Sorry for bothering.
    Somehow, I can not delete this post, if a moderator could delete it, that would be much appreciated.

    Best,

    Comment


    • #3
      The FAQ Advice explains. Threads you start are shared property. In general, threads are not deleted. The explanation of your problem could help someone else, so the best way to close a thread is to complete the story.

      Comment


      • #4
        Indeed.
        In this specific case, the story is: "one should put "using" before calling a file in merge".

        Best,

        Comment

        Working...
        X