[EpiData-list] How to - analysis: Routine reporting (Check if count is larger than 0)

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Wed Jan 17 03:09:40 CST 2007


When doing routine reporting we never know in advance if there are some
observations for a given table in analysis.

Therefore:
   read rawfile_from_patientsystem.csv   /close
   means y sex

would stop if no persons had any data in variable y
The technique in analysis to control this is:

read rawfile_from_patientsystem.csv   /close
* first count the number   (with /q the result is not shown)
count if y <> .   /q
imif $count > 0 then
  means y sex
else
 type "No data in y or sex"
endif

Another useful technique is to find the period in the data. By sorting on
the date variable and save the result as a constant this can be used in a
"report".

read rawfile_from_patientsystem.csv
* sort on a given variable containing date:
sort entrydate
define first ________________ global
define last ________________ global
first =    string(vmeb001[1])
count
last = string(vmeb001[$count])
type "test - @first - @last"  /h3

If one adds then "cls" to clear the screen or "set echo = off", then only
the result of the type command is shown. But only do this when it is all
working. I am writing on a manual of "how to write menusystems" for
release later this year. The techniques above will be part of that.

Jens Lauritsen
EpiData Association




More information about the EpiData-list mailing list