Statalist The Stata Listserver


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

Re: st: On command "table": how to avoid blank cells after summation


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: On command "table": how to avoid blank cells after summation
Date   Sun, 27 Aug 2006 14:09:16 +0100 (BST)

--- "FUKUGAWA, N." <[email protected]> wrote:
> I compute summation of one variable as follows.
> 
> . table AREA YEAR, c(sum var1) by(CAT) format(%8.0f)
> 
>           | 1983  1984  1985  1986  1987  1988  1989  1990  1991
>         1 |    4    32     7     6    17    44    46    34     5
>         2 |                     10           8     2
> 
>         3 |               14     4                       7
> 
> 
> By default, cell is left blank if no observation is found (for
> instance, YEAR==1983 and AREA==2).
> I would like to avoid blank cells in the table and have a table
> as follows.
> 
>           | 1983  1984  1985  1986  1987  1988  1989  1990  1991
>         1 |    4    32     7     6    17    44    46    34     5
>         2 |    .     .     .    10     .     8     2     .     .
>         3 |    .     .    14     4     .     .     .     7
>                .
> 

A combination of -collapse- and -fillin- might be helpful here, like in
the example below:

*------------begin example------------
sysuse auto, clear
collapse price mpg
list
fillin rep78 foreign
list
*-------------end example-------------

HTH,
Maarten



-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


	
	
		
___________________________________________________________ 
All new Yahoo! Mail "The new Interface is stunning in its simplicity and ease of use." - PC Magazine 
http://uk.docs.yahoo.com/nowyoucan.html
*
*   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