ddionrails / collect_stata

Accumulate data from stata files and write it into an open format
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Create Stata Testfile with special missing values #40

Open mpahl opened 5 years ago

mpahl commented 5 years ago

Create tests and testfiles with missingvalues "." and ".a"-".z". See dmissingvalues

mpahl commented 5 years ago

How it is: TESTCAT = "-1 -1 .b 2 1 . 1 2 1 2 .b 1 1 2 2" scale: cat valid: labeled values (also negativ values) invalid: stata missings

TESTSTRING = ". a b .a . c . .b . d e f f f g" scale: str valid: every string and stata missings with letters (.a - .z) invalid: stata missings without letters (.)

TESTNUMBER = "3 .a -2 5 10 . 15 100 10 2 -1 3 4 5 6" scale: num valid: all positiv numbers invalid: negativ number and stata missings

local TESTOTHER = "-1 a -2 5 b . 15 x 2 .a b 1 2 y z" scale: str valid and invalid like TESTSTRING, numbers are strings

mpahl commented 5 years ago

"."-Missings are always invalid ".a-.z" aren't recognized as invalid for string variables negativ numbers are valid for cat variables but invalid for num variables

How this should be handled?

hansendx commented 5 years ago

Strings in the form of ^\.[a-z]{0,1}$ should be recognized as invalid. Numbers might be a problem. Maybe we could add a parameter to customize invalid values for different studies in the future.