Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: Results to file problem


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Results to file problem
Date   Thu, 6 Dec 2012 09:05:38 +0000

My guess:

r(adj) contains a vector. You can't write a vector as if it were a scalar.

You would need to do some pre-processing to split it into scalars.

Nick

On Thu, Dec 6, 2012 at 8:50 AM, arosella <[email protected]> wrote:
> Hi All,
> I'm using Stata 12.1 on W7 and trying to write a txt file
> after the command -dstdize-
> Here my code:
>
> webuse hbp
> generate pop=1
> file open myfile1 using "E:\Alberto\tab_sep.txt", write replace
> set more off
> file write myfile1  "Tasa Cruda" _tab "Tasa Ajustada" ///
>                   _tab  "SE Tasa Ajus"   _tab  "LowerCI" ///
>                   _tab  "UpperCI"
> dstdize hbp pop age race sex, by(city year)
> file write myfile1  (r(crude)) ///
>               _tab  (r(adj))   ///
>         _tab  (r(se))    ///
>         _tab  (r(lb))    ///
>         _tab  (r(ub))
>
> file close myfile1
> set more on
>
> And here the erro I get:
>
> . file write myfile1  (r(crude)) ///
>>               _tab  (r(adj))   ///
>>                       _tab  (r(se))    ///
>>                       _tab  (r(lb))    ///
>>                       _tab  (r(ub))
> type mismatch
> r(109);
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index