A document which Jamie Hockin and I wrote on how to create your own commands in EpiData Analysis is found on the page www.epidata.dk/documentation.php.
As an example it is shown how to do loops. The document is partially correct and a new version will appear. I used the principle recently to write address labels in a given project.
First I read the file myfile and afterwards run the pgm file. In the file the following fields are read into memory as variables: (english term in parenthesis): idnr (id), navn (name), adresse (address), postnr (zip code), by (town) ........... start pgm .............................. * test recursive cmd * set echo=off define s # global s=1 logopen "adresslist.txt" /close /replace
test
cmd test * count how many records we have: count set echo = off define n ### global n = $count * n = 10 // use this for testing define line1 _______________________________________________________ global define line2 _______________________________________________________ global define line3 _______________________________________________________ global * loop over the "n" occurrences - i.e. similar to while s < n. * s references the record number by [s]
imif s<=n then imif length(navn[s]) > 0 then *dolabel line1 = string(idnr[s]) + " " + navn[s] line2 = adresse[s] line3 = string(postnr[s]) + " " + by[s] type "@line1 <br> @line2 <br> @line3 <br>page <br>" endif s = s + 1 test endif end
logclose set echo=on type "All done when s=@s"
........... end pgm ..............................
regards Jens Lauritsen EpiData Association