CancerRegistryOfNorway / nordcansurvival

Other
0 stars 0 forks source link

survival_statistics with .csv life table does not finish #7

Closed WetRobot closed 3 years ago

WetRobot commented 3 years ago

It appears to only create the .dta version of the life table file and then stop.

This is currently circumvented in nordcanstat_survival by calling survival_statistics twice, but I suppose it's better to fix the the underlying stata implementation.

BjarteAAGNES commented 3 years ago

from the code only: this should not happen unless the cvs import fails or the directory is RO:

(could you run with trace on )

if ( strlower(substr("`lifetable'",-4,.)) != ".dta" ) {

import delimited using "`lifetable'" , ///
    varnames(1)       /// 
    encoding("UTF-8") ///
    delimiter(";")    ///
    case(preserve)    ///
    asdouble

capture rename age _age
capture rename year _year

sort  _year  sex  _age

mata : st_local("lifetable", pathrmsuffix("`lifetable'"))

save "`lifetable'" , replace

}

BjarteAAGNES commented 3 years ago

or the dta exists AND IS RO

BjarteAAGNES commented 3 years ago

the fix which will be implemented AFTER the 2. Oct version : from line 30:...

    mata : st_local("stub", pathrmsuffix("`lifetable'"))

    save "`stub'" , replace
    confirm file "`stub'.dta" 
    local lifetable = "`stub'.dta" 
BjarteAAGNES commented 3 years ago

https://github.com/CancerRegistryOfNorway/nordcansurvival/commit/e7714086bc72b16b6e974f0879e369a2b5ac8082

BjarteAAGNES commented 3 years ago

The fix on the R side can be removed, and new code tested.