Greetings, Jamie. I agree and I do understand "padding" strings. However, the Example I used was age as integer and sex and integer. The reason I chose this example was because using Epi604D Analysis and issuing the command Tables age sex the result was 1-n for age and 1-2 for sex. The data is stored as integers for both. Having to convert to string and then pad sounds a bit much. I suggest that the TABLES command using integers in both Fields be changed to produce the same ordering as FREQ. And, if padding is going to be so important, I agree there should be a function.
I do appreciate your response and I have encountered a few other items Of Which I'm keeping track and will send along once I have exhausted my efforts.
Have a great weekend and stay safe, Kelly
Kelly Bussell CDC Atlanta
-----Original Message----- From: epidata-list@lists.umanitoba.ca [mailto:epidata-list@lists.umanitoba.ca] Sent: Thursday, January 13, 2005 3:07 PM To: epidata-list@lists.umanitoba.ca Subject: [EpiData-list] re: tables
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
participants (1)
-
epidata-list@lists.umanitoba.ca