Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: corrections to tabl, shows value labels and codes


From   M Hollis <[email protected]>
To   [email protected]
Subject   st: corrections to tabl, shows value labels and codes
Date   Wed, 8 Aug 2007 21:14:15 -0700 (PDT)

I've often been frustrated by the fact that a one-way tabulate doesn't have the option to show both the value labels and the underlying codes. I did a search on the statalist and found this message and its replies:
http://www.stata.com/statalist/archive/2007-03/msg00558.html

The thread points to a user-created command, tabl, which was designed to do exactly this. Unfortunately, as noted in the previous thread, the command as downloaded contains errors and doesn't work properly. I'm not much of a programmer, but I know enough to do some debugging. So, I think I've figured out the steps necessary to fix it. To install tabl, type:

net describe tabl, from(http://www.fss.uu.nl/soc/iscore/stata)

in the command window and then follow instructions to install. Open the ado file in the do-file editor or other text editor (by default it's in c:\ado\plus\t). Then make the following changes:

1) line 26 is missing a bracket. It should read: if "`missing'" == "" {
2) replace line 69 ("di") with the following lines:
         di
         di in gr "`vlab'"
         di
         di in gr _col(`col1') "   code  |   Freq    Percent  "
         di in gr _dup(`col1') "-"        "--------+--------------------"

3)insert at about line 23 (below the line "sytax varname....") a new line:
         marksample touse, novarlist


That, hopefully, is all you need to do. Seems to be working fine for me. Please let me know if it also works for you. I'm contemplating distributing a copy of the ado to the students in my intro stats class this fall, because it's really helpful for them to be able to see both the labels and values. They are pretty skittish about using stata as it is, though, so I don't want to get them confused by any bugs.

Also, I should note that the ado file seems to have the initial programming for a "compact" option, see examples at the end of the ado file as well as the section that starts at line 54 of the updated ado file with "if "`compact'" != "" {". As far as I can tell, though, the local `compact' is never defined and so this option is never invoked.  The examples seem to suggest that the compact option is appropriate for very long value labels, it's hard to tell whether it's supposed to be automatically selected if labels are over a certain length or a command option. It does suggest that the current version may cause problems when used on variables with very long labels (although you can use the width option).


MH




____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index