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

st: Re: column total


From   "Marcela Perticara" <[email protected]>
To   <[email protected]>
Subject   st: Re: column total
Date   Tue, 21 Jan 2003 21:39:39 -0300

Note that in the same way the mean is stored in r(mean) the sum of the
variable is stored
 in r(sum). Type return list.
The command collapse can create datasets with summary statistics.



=====================
Universidad Alberto Hurtado
Departamento de Economia y Administracion
Erasmo Escala 1835
Santiago, 6500620
CHILE
Phone: (56-2) 698-0046, 671-7130 (Ext. 265)
Fax (56-2) 696-4880

----- Original Message -----
From: "Rajiv Mallick" <[email protected]>
To: <[email protected]>
Sent: Tuesday, January 21, 2003 7:15 PM
Subject: st: column total


> The following code gives me means of the variables.  How can I modify the
> following code to obtain column total of variables Price1 Price2 and
Price3?
>
> OR is there a better way of collecting column total of variables and store
> in a .dta file.
>
> If you want to verify, the column totals are 456229.018, 1576.0002,
> 221.499982 for Price1 Price2 and Price3.
>
> Thank you all for your suggestions.
> Rajiv
>
> code
> -----------
> clear
> use "D:\Stata\auto.dta", clear
> rename price         price1
> rename mpg           price2
> rename headroom price3
> local vars price1 price2 price3
>
> postfile temp_res m1 m2 using "e:\clm\data\temp_res.dta",double replace
>
> foreach v of local vars {
>   qui summ `v',detail
> post temp_res (r(mean))
> }
> postclose temp_res
> clear
> --------------------
> end of code
>
>
> Rajiv Mallick
> 504 818 0204
>
>
>
>
> _________________________________________________________________
> Add photos to your messages with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/featuredemail
>
> *
> *   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/

*
*   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