How to: Change id variable type from numerical to string
A question that came to epidata.dk:
In our EPI test.rec file we have made a 'clientnumber' field for a maximum of 7 numbers entry (#######), for example to enter clientnumber 3458. This test.rec file contains now several records. But now we need to use the same field for entering a letters and digits combination, f.e. P3467188. I realise that we should have designed a string field <a
.
The clientnumber field not only needs to be longer than 7 numbers but should be suitable for letters as well.
Is it possible to change that in our current test.rec file? We prefer that over making a new .qes file and an empty .rec file.
This is of general interest.
the solution: 0. Make sure you have proper backup in case something goes wrong.
1. Either add a new field in the qes file with the letter part add a new field for combined letter + number add 2. or make qes and change to string field the same field update the rec file (just enter and epidata will ask )
3. If you wish to add a certain letter to all previously added records add a recode block to the chk file or other file and run recode from the tools menu. See help file on recode e.g. if new string type id field is idNew and the old numerical one is id
recodeblock idletter = "F" idnew = idletter + string(id) end
plus to accomplish future records in same file: idnew noenter end
idletter mustenter end
id mustenter after entry idnew = idletter + string(id) end end
participants (1)
-
epidata-list@lists.umanitoba.ca