<>
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: [email protected]
[mailto:[email protected]] Im Auftrag von Ekaterina
Hertog
Gesendet: Montag, 2. November 2009 15:47
An: [email protected]
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/