Statalist


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

Re: st: How to quietly svmat ?


From   "Sergiy Radyakin" <[email protected]>
To   [email protected]
Subject   Re: st: How to quietly svmat ?
Date   Wed, 12 Nov 2008 11:24:43 -0500

Thank you, Joseph,

that is news to me, I thought the 'more' message is triggered by
overflow of the display buffer, and can never occur if I suppress
output with either -quietly- or -capture-. I'd prefer your solution
over Kit's, but thanks goes to all who responded.

Best regards, Sergiy


On Wed, Nov 12, 2008 at 9:53 AM, Joseph Coveney <[email protected]> wrote:
> Sergiy Radyakin wrote:
>
> the -svmat- Stata command has an inconvenient interactivity feature,
> which always requests a confirmation, e.g.:
>
> . svmat R
> number of observations will be reset to 9
> Press any key to continue, or Break to abort
> obs was 0, now 9
>
> If -quietly- or -capture- is applied, the text is not displayed, but
> there is still a -more- condition, which pauses the execution of the
> .do/.ado file, even if the dataset is empty (cleared with -clear-)
> immediately before -svmat-.
>
> Can this behaviour be changed somehow?
>
> Currently, the only work around I've found is the following:
>
> quietly {
>    clear
>    set obs `=rowsof(R)'
>    generate junk=_n
>    svmat R
>    drop junk
> }
>
> Note that even if the number of observations is set to the number of
> rows in R, it is not sufficient for some reason to avoid the
> confirmation. There must be a variable in the dataset. Can somebody
> advise a shorter piece of code?
>
> --------------------------------------------------------------------------------
>
> Have you tried -set more off-?
>
> clear *
> set more off
> quietly describe
> assert r(N) == 0
> assert r(k) == 0
> matrix define M = J(4, 4, 0)
> quietly svmat M
> list
> exit
>
> gives:
>
> . clear *
>
> . set more off
>
> . quietly describe
>
> . assert r(N) == 0
>
> . assert r(k) == 0
>
> . matrix define M = J(4, 4, 0)
>
> . quietly svmat M
>
> . list
>
>    +-------------------+
>    | M1   M2   M3   M4 |
>    |-------------------|
>  1. |  0    0    0    0 |
>  2. |  0    0    0    0 |
>  3. |  0    0    0    0 |
>  4. |  0    0    0    0 |
>    +-------------------+
>
> . exit
>
> end of do-file
>
>
> If you want -more- to be set on routinely, then you could write a wrapper
> for -svmat- that toggles the more condition:
>
> program define svmat3
> version 8.2
> local more_condition `c(more)'
> set more off
> quietly svmat `0'
> set more `more_condition'
> end
>
> Joseph Coveney
>
>
> *
> *   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