Statalist


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

Re: AW: st: Save estimates in a data file


From   Rafael Claro <[email protected]>
To   [email protected]
Subject   Re: AW: st: Save estimates in a data file
Date   Wed, 4 Nov 2009 15:29:51 -0200

Dear Friends,

Sorry about the long delay in my answer but I had an emergency in the last few days.

Martin,
I forgot about the “collapse” but I was able to handle it and solve my problem.

Also, the “postfile” suggestion came to be very useful for handling other complication.

Thanks once again for your great help.

Rafael Claro
Center for Epidemiological Studies in Health and Nutrition (NUPENS-USP) 
Nutrition Department - University of São Paulo 
Av Dr Arnaldo, 715; Phone: (11) 3068 9434 
São Paulo-SP-Brazil



Em 29/10/2009 08:09, Martin Weiss < [email protected] > escreveu:

 



How does this example address the -over()- option which Rafael wanted in
addition to conditioning on "mm"?

Note you create a -tempfile- but end up using a permanent one by the name of
"temp1.dta" while `temp1' remains "idle"...

Conditioning on the return code from -summ- is unusual, what is your
intention there? Note that the return code is zero, even if the -if-
qualifier cannot be satisfied:

***
clear*
set obs 1
gen x=5
gen y=7
su x if y==6
di in r _rc
***

You can of course -count- beforehand, and then condition on the returned
value -r(N)- being different from zero...


HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Lists
Gesendet: Donnerstag, 29. Oktober 2009 11:02
An: [email protected]
Betreff: Re: st: Save estimates in a data file

Does this example help at all?

clear
set obs 100
g var1 = uniform()
g var2 = _n

tempfile temp1

postfile means num mean using "temp1", replace

forval i = 5(5)100 {
capture su var1 if var2  Dear Listers,
> 
> IÔÇÖve been trying to save the results of an analysis as a new data file. 
> 
> The scenario is very simple. First I estimate some ÔÇ£meansÔÇØ with the
command:
> 
> foreach x of local mm {
> mean income if mm == `xÔÇÖ, over( track)
> }
> 
> where:
> mm = 1200
> track = 10
> 
> Then, these estimated values (track number and mean value only) have to be
saved in a new data file, specific to each ÔÇ£mmÔÇØ value.
>  
> IÔÇÖve been trying to solve this with the command ÔÇ£estimates saveÔÇØ but
I have not been able of doing it so.
>  
> My only option now is to generate the ÔÇ£meansÔÇØ, with egen, directly on
the data file, drop all other information and then save the file with a
different name. however Im pretty sure that there might be a
simpler/easier way of doing it.
> 
> Thanks in advance for your help.
> 
> Best,
> RClaro
> *
> *   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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index