Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: Is it possible to save a scalar saved after -summarize- as a variable?


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: Is it possible to save a scalar saved after -summarize- as a variable?
Date   Mon, 2 Nov 2009 16:11:36 +0100

<> 

BTW, my reply only pertained to the technical aspect of capturing the
-r(sum)- returned value. This value stores the number of observations for
the two methods which is not what you want. Here is a better solution:


*************
clear*
set obs 1000

gen byte method=runiform()<.3
gen byte accept=runiform()<.7

bys method: egen sum=total(accept)
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Ekaterina
Hertog
Gesendet: Montag, 2. November 2009 15:47
An: statalist@hsphsun2.harvard.edu
Betreff: st: Is it possible to save a scalar saved after -summarize- as a
variable?

Dear all,
I have data  on people using different methods to ask people on a date 
(e.g. via internet, at a party etc) and I would like to see if some 
methods on average lead to greater number of acceptancies than others.
For that i need to create a variable which summarizes a number of 
acceptances by method. I created a variable accept which equals 1 if a 
date proposal is accepted and 0 if it is unsuccessful.
I then run the following command:

bysort method: su accept

am I correct in assuming that r(sum) scalar saves the total number of 
ones by each method in this case? And if yes is it possible to generate 
a variable that would equal this saved r(sum) scalar by each method?
I would be very grateful for advice,
Warm regards,
Ekaterina
*
*   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/


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



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