BUG: NaN values not converted to Stata missing values

Stata does not correctly handle NaNs, and so these must be replaced with Stata
missing values (. by default).  The fix checks floating point columns for nan
and replaces these with the Stata numeric code for (.).

The write_index option was also being ignored by omission. This has been fixed and
numerous tests which were not correct have been fixed.