[EpiData-list] preventing duplicate entries

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Mon Nov 23 14:43:07 CST 2009

I like it! I had thought along those lines but did not know how to 
concatenate strings.

I received your PS too; thanks.

One other question:  I just became involved in this existing project. 
The data date back to 2003, and had been recorded in Excel spreadsheets, 
a separate Excel file for each site, and within each file a separate 
worksheet for each month, with several years' worth of that month on 
that sheet.  Now everything is in Epidata. Unfortunately, the existing 
data have many duplicate site-date records. What do you think will be 
the effect of implementing your suggestion, given this circumstance?

I have the analysis set up to run in R, and I think I can make R ignore 
duplicate site-date combinations. So the existing duplicates would 
remain in the database but have no effect on analysis. If need be, could 
I implement your suggestion only prospectively, for new entries?


Christopher W. Ryan, MD
SUNY Upstate Medical University Clinical Campus at Binghamton
425 Robinson Street, Binghamton, NY  13901

"If you want to build a ship, don't drum up the men to gather wood, 
divide the work and give orders. Instead, teach them to yearn for the 
vast and endless sea."  [Antoine de St. Exupery]

epidata-list at lists.umanitoba.ca wrote:
> I am entering daily visit counts to walk-in clinics in our area. There 
> are 6 clinics or sites. So a record is uniquely identified by site and 
> date. Is there a way to prevent the entry of records with a site-date 
> combination that duplicates a site-date combination that already exists 
> in the database?
> The easiest is: - assume your file name is walk_in.rec and walk_in.qes
> 0. make a backup of your data to some other media or drive
> 1. add a text field (fldcontrol), e.g. length 75 to your walk_in.qes 
> file at the bottom.
> 2. open the file walk_in.rec for entry
> 3. entry will ask you to update your rec file with changed structure.
>       accept this with a "yes/ok"
> 4. close the file without entering any new records
> 5. add to the chk file the following:
>     assuming your first field is site and second field is clinic number:
> site
> mustenter
> end
> clinic
>  mustenter
>  after entry
>    fldcontrol = string(site) + "-" + string(clinic)
>  end
> end
> fldcontrol
>  noenter
>  key unique
> end
> If you enter any again a warning will come out automatically since the 
> key unique is tested at assignment of the value, not at the field (which 
> is never entered).
> Let us know on the list whether this works.
> regards
> Jens Lauritsen
> _______________________________________________
> EpiData-list mailing list
> EpiData-list at lists.umanitoba.ca
> http://lists.umanitoba.ca/mailman/listinfo/epidata-list

More information about the EpiData-list mailing list