Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Results to file problem


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
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 <arosella@irccsdebellis.it> 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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index