help readreplace


readreplace -- Make many replacements to a dataset from a .csv file


readreplace using filename , id(varname) [display]

options Description ------------------------------------------------------------------------- id(varname) Required. Name of unique identifier display show detail on what readreplace is doing -------------------------------------------------------------------------


readreplace makes replacements using a very specifically-formated .csv file. It is intended for use with the output from cfout.


readreplace is intended to be used as part of the data entry process when data is entered two times for accuracy. After the second entry, the datasets need to be reconciled. cfout will compare the first and second entries and generate a list of discrepancies in a format that is useful for the data entry teams. The data entry operators can then simply type the correct value in a new column of the cfout results. To make the changes in your dataset, load your data then run readreplace using the new .csv file.

readreplace requires the using file to be a .csv file with the format

id value, question name , correct value

It then runs the replaces

replace question name = correct value if id varname == id value

for each line in the csv file, with allowances for whether the variables/ids are string or numeric. The display option is useful for debugging. The first row is assumed to be a header row, and no replacements are made to data in the first row.


readreplace using "corrected values.csv", id(uniqueid)

Also see

Online: cf, cfout