Thanks for your suggestion, Eric!
I just repeated employing the commands 'preserve' and 'restore' to
generate different sub-sample datasets, like follows:
capture program drop winsor_all
program define winsor_all
foreach var of varlist Invest_Ratio Employ_Level Sales_growth
delta_NWC_by_Assets Investments_by_Assets ln_Assets
Cash_flow_by_Assets Tax_Ratio RPT_Ratio CF {
winsor `var', gen(temp) p(0.01)
drop `var'
rename temp `var'
}
end
use dta\data_original_all, clear
preserve
winsor_all
foreach var of varlist credit_NERI decentr_NERI legal_NERI market_NERI
ln_CRMP FD_1 FD_2 pref_policy ln_RCC mkt1 mkt2 {
gen CF_`var' = `var'*D_PRI*CF
}
save dta\data_all, replace
restore
preserve
keep if D_PRI != 1
winsor_all
foreach var of varlist credit_NERI decentr_NERI legal_NERI market_NERI
ln_CRMP FD_1 FD_2 pref_policy ln_RCC mkt1 mkt2 {
gen CF_`var' = `var'*D_PC*CF
}
save dta\data_SOE, replace
restore
... ...
and many criterion to form different sub-samples
On 12/4/09, Eric Booth <[email protected]> wrote:
>>
>>
>
> Here's a posting from Alan Riley, from StataCorp, that may help you. It
> appears that the user was getting the error while using a series of
> temporary files (via -postfile-) while utilizing preserve/restore.
>
> http://www.stata.com/statalist/archive/2003-04/msg00637.html
>
> Can you give an example the commands you are running when this error
> appears?
>
>
> ~ Eric
> __
> Eric A. Booth
> Public Policy Research Institute
> Texas A&M University
> [email protected]
> Office: +979.845.6754
>
>
> On Dec 4, 2009, at 1:18 AM, Zhou Yuxiao wrote:
>
>> Dear statalists,
>>
>> Sometimes when I use the command 'restore' after 'preserve', Stata
>> will report an error noted 'check results window for filename stata
>> restore', then stop to exit.
>>
>> For my personal habits, I use 'preserve' and 'restore' frequently to
>> repeat some job which need information in certain dataset.
>>
>> Thank you for any suggestion!
>>
>> Thanks & Regards,
>> --
>> Zhou Yuxiao
>> Research Assistant
>> Department of Accountancy
>> City University of Hong Kong
>> 83 Tat Chee Avenue
>> Kowloon Tong
>> Hong Kong
>> *
>
>
>
> *
> * 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/
>
Thanks & Regards,
--
Zhou Yuxiao
Research Assistant
Department of Accountancy
City University of Hong Kong
83 Tat Chee Avenue
Kowloon Tong
Hong Kong
*
* 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/