Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: Question dealing with Missing Values and Tabulating

From   "Svend Juul" <[email protected]>
To   <[email protected]>
Subject   RE: st: Question dealing with Missing Values and Tabulating
Date   Thu, 26 May 2005 19:44:49 +0200

Ashish has two questions about missing values and about tabulating data.
In general missing values are omitted from tabulations and calculation
of percentages, so you need not drop observations with missing values.
If you on the contrary want the see the missing category, use the
-missing- options, as in:
  tab1 content2 , missing
I do have doubts about the way you use -encode- because you don't control
which numeric codes are assigned to which text strings. Text strings are
sorted alphabetically and given the numeric codes 1,2,3 - unless you
define value labels corresponding exactly to the text strings AND inform
-encode- about which labels to use. So the commands you gave could be:
label define agree 1 "Strongly   agree" 2 "Agree" 3 "Neither agree nor disagree" 4 "Disagree" 5 "Strongly   disagree"

encode lessoncontent~o, gen(content) label(agree)
recode content (1 2 = 2) (4 5 = 4), gen(content2)  
label values content2 agree
tab1 content2
encode detailprovide~p, gen(detail) label(agree)
recode detail (1 2 = 2) (4 5 = 4), gen(detail2) 
label values detail2 agree
tab1 detail2 
encode thelevelofdif~s, gen(difficulty) label(agree)
recode difficulty (1 2 = 2) (4 5 = 4), gen(difficulty2) 
label values difficulty2 agree
tab1 difficulty2

Note that the label agree is common to all three variables, so you only
need define it once. The label() option to encode defines the codes
generated, provided the labels correspond exactly to the original
text strings.
Although they are variations to -tabulate- I prefer -tab1- for 
one-variable tables and -tab2- for two-variable tables (as you 
will see shortly).
Including horizontal percentages in a two-variable tabulation should be simple:
  tab2 status haveyoureceiv~t , row
If you want to display missing categories it is:
  tab2 status haveyoureceiv~t , row missing
To help yourself you could have studied in more detail the manual entries 
(Stata 8):
[R] tabulate
[R] encode
[R] label
Hope this helps
Svend Juul
Institut for Folkesundhed, Afdeling for Epidemiologi
(Institute of Public Health, Department of Epidemiology)
Vennelyst Boulevard 6 
DK-8000 Aarhus C,  Denmark 
Phone, work:  +45 8942 6090 
Phone, home:  +45 8693 7796 
Fax:          +45 8613 1580 
E-mail:       [email protected] 

*   For searches and help try:

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