Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: RE: table command and missing values in row variable
From
"Nick Cox" <[email protected]>
To
<[email protected]>
Subject
st: RE: table command and missing values in row variable
Date
Wed, 26 May 2010 20:36:19 +0100
I've not noticed before but -table- is pretty resistant to suggestions to show (system) missing. I can't think of a rationale.
This works, and clearly doesn't rule out better solutions:
clonevar rep78_2 = rep78
replace rep78_2 = .a if missing(rep78)
label define rep78_2 .a "missing"
label val rep78_2 rep78_2
. table for rep78_2
----------------------------------------------------------------
| Repair Record 1978
Car type | 1 2 3 4 5 missing
----------+-----------------------------------------------------
Domestic | 2 8 27 9 2 4
Foreign | 3 9 9 1
----------------------------------------------------------------
Nick
[email protected]
Jeremy Page
I am using Stata/SE 10.1 with Windows XP. I am attempting to create a
table using the -table- command with a row variable which has missing
values. I would like the missing value of the row variable to be
included in the table, but when I use -table- the missing observations
are not shown in the table. I am a little confused at why the missing
values don't appear in the table. In the help section there is an
option called -concise- which is supposed to "suppress rows with all
missing entries." This leads me to believe that the table command
without the -concise- option should list the missing values. Am I
interpreting the help file incorrectly? I have reproduced my problem
using the auto data. I have included my .do file and log below.
When I run a two way -tab- with "rep78", "foreign" and I include the
missing option I see the missing values of "rep78". When I use
-table- the missing values of "rep78" are suppressed with or without
the option -concise-.
************do**************
clear all
webuse auto
tab rep78 foreign,m
table rep78 foreign
table rep78 foreign, concise
***********log ****************
. clear all
.
. webuse auto
(1978 Automobile Data)
.
. tab rep78 foreign,m
Repair |
Record | Car type
1978 | Domestic Foreign | Total
-----------+------------------
----+----------
1 | 2 0 | 2
2 | 8 0 | 8
3 | 27 3 | 30
4 | 9 9 | 18
5 | 2 9 | 11
. | 4 1 | 5
-----------+----------------------+----------
Total | 52 22 | 74
.
.
. table rep78 foreign
------------------------------
Repair |
Record | Car type
1978 | Domestic Foreign
----------+-------------------
1 | 2
2 | 8
3 | 27 3
4 | 9 9
5 | 2 9
------------------------------
. table rep78 foreign, concise
------------------------------
Repair |
Record | Car type
1978 | Domestic Foreign
----------+-------------------
1 | 2
2 | 8
3 | 27 3
4 | 9 9
5 | 2 9
------------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/