UrbanInstitute / education-data-package-stata

MIT License
19 stars 4 forks source link

convert ncessch_num from float to double to fix precision issue #65

Closed VivianSihanZHENG closed 3 years ago

VivianSihanZHENG commented 3 years ago

Variable ncessch_num was defined as float in STATA; but since float only has 7 digits of accuracy, and ncessch_num usually has 11 or 12 digits, we convert it to double, which has 16 digits of accuracy.

VivianSihanZHENG commented 3 years ago

Also, you may want to review line 981 chunk:

      for (c=1; c<=length(varinfo[6,.]); c++){
          if (varinfo[6,c] == "1" && varinfo[3,c] == "float"){
              if (validfilters == "") validfilters = varinfo[1,c]
              else validfilters = validfilters + ", " + varinfo[1,c]
          }
      }

Does changing to double not capture something important here? I can't remember, so may need to test.

The original if-statement indicates "if the variable is a filter and an integer". But since no float variable is set as a filter in the metadata, if we change the if-statement toif (varinfo[6,c] == "1" && varinfo[3,c] == "double") (double includes both integer and float variables now), I think the results won't be affected.