[EpiData-list] re: tables

epidata-list at lists.umanitoba.ca epidata-list at lists.umanitoba.ca
Thu Jan 13 14:06:56 CST 2005


Numeric fields display in the correct (ascending) order in FREQ. e.g.

. freq time
TIME    No.    %
  0    1    2.50
  1    1    2.50
 14    1    2.50
 22    1    2.50
 31    1    2.50
...
 98    1    2.50
102    1    2.50

However, text fields are normally left-justified, even though FREQ shows 
them right-justified. With the same data and
. define a ___
. let a = time
. freq a
A      No.    %
  0    1    2.50
  1    1    2.50
102    1    2.50
104    1    2.50
119    1    2.50
123    1    2.50
138    2    5.00
 14    1    2.50
154    2    5.00
162    1    2.50
181    1    2.50
202    1    2.50
 22    1    2.50

To right-justify the text field (or a copy of the text field would be 
safer as shown here):

. define b ___
. b = copy("   ",1,3-length(trim(a)))+a
. freq b
    B    No.    %
  0    1    2.50
  1    1    2.50
 14    1    2.50
 22    1    2.50
 31    1    2.50
...
 92    1    2.50
 97    1    2.50
 98    1    2.50
102    1    2.50
104    1    2.50

I've used version 0.9 Build 17. This is a trick that is necessary with 
other systems as well, as strings tend to be stored left-justified 
unless you design it otherwise.

Rather than have FREQ take care of this, it might be preferable to have 
a function to do the right-alignment of a field or do the left-padding 
of a string. e.g. b = LPAD(a)

Jamie Hockin
Public Health Agency of Canada


More information about the EpiData-list mailing list