1. Sumfreq / Sumtables (epidata-list@lists.umanitoba.ca)
Has anyone an idea on how to replace Sumfreq (or sumtables) with Epidata analysis? Thanks! Gilles / Paris
I understand the sumfreq and sumtables command to be able to do a frequency or crosstable but instead of counting observations the counting would be made with another variable.
Example from testdata: read bromar tab agegrp . freq agegrp agegrp Age (10 year intervals) No. % 10 35 0.92 20 489 12.92 30 1198 31.64 40 1337 35.31 50 642 16.96 60 75 1.98 70 9 0.24 80 1 0.03 Total 3786 100%
We can now collapse or aggregate the data file like this on agegrp: . agg agegrp /close //"agg" is the same as "aggregate" AGEGRP N 10 35 20 489 30 1198 40 1337 50 642 60 75 70 9 80 1
Now if we do a frequency on agegrp: agegrp Age (10 year intervals) No. % 10 1 12.50 20 1 12.50 30 1 12.50 40 1 12.50 50 1 12.50 60 1 12.50 70 1 12.50 80 1 12.50 Total 8 100%
We have one observation for each value of agegrp. 8 records or observations in total. By listing all observations we can see that the variable N tells us how many are in each agegrp: list AGEGRP N 10 35 20 489 30 1198 40 1337 50 642 60 75 70 9 80 1
So in principle we would like a "backwards" aggregate where the weight or counting is by "N":: . freq agegrp /weight=n /
Age (10 | year | intervals) | Freq. Percent ------------+-------------------- 10 | 35 0.92 20 | 489 12.92 30 | 1198 31.64 40 | 1337 35.31 50 | 642 16.96 60 | 75 1.98 70 | 9 0.24 80 | 1 0.03 ------------+------------------ Total | 3,786 100.00
Unfortunately the table just shown was made in Stata not in EpiData Analysis, but I have added sumfreq and sumtables to the workplan.
Please discuss on the list if the /weight= x principle is what we want. I have met various needs for weighting, but assume that the simple frequency weight shown here is sufficient.
Regards
Jens Lauritsen EpiData Association