[EpiData-list] How to import and restructure data and create a report every month in an easy way ?

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Tue Apr 5 04:15:30 CDT 2005


Someone asked off line how to accomplish this

If you have to restructure files often based on the same qes file the revision of structure can be saved as EpiC commands in a batch or command file (e.g. revise.cmd) 

See the documentation for EpiC for further instructions, e.g.: 
EpiC revise newqes.qes datafile.rec FIRST  FORCE LOG="what_happended.log"

Would revise the file "datafile.rec" based on contents of "newqes.qes" and force restructuring regardless of this would mean loosing fields (Option FORCE). The results are saved to the log file "what_happended.log"

EpiC can do other parts also, e.g. create or open a zip archive or encrypt (decrypt) files.

EpiC is available from the download page of http://www.EpiData.dk

Example: Assume you recieve files with administrative data every month called datafile1.txt datafile2.txt datafile3.txt 

To import these data, make control lists and prepare a reports you do this:

Create 
- a file called structure.qes which contains the same format for fields as the txt file with administrative data.
- a file called newstructure.qes containing the fields you wish to keep in an approriate format.
- a file called report.pgm which will in analysis append the three files and make a standard report.

Then create the file revise.cmd with this content:

*.......revise.cmd ....................................................................
EpiC revise newqes.qes datafile.rec FIRST  FORCE LOG="what_happended.log"
EpiC import TXT datafile1.txt qes=structure.qes out=datafile1.rec delim=; q=text ignorefirst  date=yymmdd 
EpiC import TXT datafile2.txt qes=structure.qes out=datafile1.rec delim=; q=text ignorefirst  date=yymmdd 
EpiC import TXT datafile3.txt qes=structure.qes out=datafile1.rec delim=; q=text ignorefirst  date=yymmdd 

EpiC revise newstructure.qes datafile1.rec FIRST  FORCE LOG="what_happended.log"
EpiC revise newstructure.qes datafile2.rec FIRST  FORCE LOG="what_happended.log"
EpiC revise newstructure.qes datafile3.rec FIRST  FORCE LOG="what_happended.log"

* then you could make a list of data from the centers involved: 
EpiC count center datafile1 datafile2 datafile3 LOG="centerlist"]

*You could also export datafile1 to a spreadsheet format for the center with number 276 for particular checks:
EpiC e xls datafile1.rec datacenter276.xls  filter="CENTER=276"

* and finally you could make a standard report using analysis:
c:\program\epidata\epidatastat  myreport.pgm
.............................revise.cmd to here

You would then only have to start the revise.cmd to create your monthly report.

Please note that now all previous postings to EpiData are available in searchable form from:
http://lists.umanitoba.ca/pipermail/epidata-list/

Jens Lauritsen
Initiator and Coordinator of EpiData
EpiData Association





More information about the EpiData-list mailing list