Statalist


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

st: Mata bug in st_sview()?


From   Sergiy Radyakin <[email protected]>
To   [email protected]
Subject   st: Mata bug in st_sview()?
Date   Thu, 12 Nov 2009 18:27:42 -0500

Dear All,

Quote 1 (p805 Mata 11 manual, PDF):
Syntax
void st_view(V, real matrix i, j)
void st_view(V, real matrix i, j, scalar selectvar)
void st_sview(V, real matrix i, j)
void st_sview(V, real matrix i, j, scalar selectvar)

Quote 2 (p759 Mata 11 manual, PDF):
selectvar may be specified as real or as a string. Observations for
which selectvar != 0 will
be selected. If selectvar is real, it is interpreted as a variable
number. If string, selectvar
should contain the name of a Stata variable.

Quote 3 (p806 Mata 11 manual, PDF)
st_view(X, ., "mpg displ weight")


Questions:
Q1) Why is the code below not working (the syntax of st_view is
identical to st_sview)? And
Q2) Why is it "not working" differently in Stata 10 (two errors) and
11 (one error)?


Best, Sergiy Radyakin



*******************
CODE
*******************

version 11
sysuse auto, clear
generate make2=make
mata
	X=1
	st_view(X,.,"price weight")
	st_view(X,.,("price", "weight"))
	st_sview(X,.,"make make2")
	st_sview(X,.,("make", "make2"))
end


***********************
EXECUTION
***********************

Execution in Stata 11.0:
. version 10.1

.
. sysuse auto, clear
(1978 Automobile Data)

.
. generate make2=make

.
. mata
------------------------------------------------- mata (type end to
exit) --------------------------------------------------------------------------------
:
: X=1

:
: st_view(X,.,"price weight")

:
: st_view(X,.,("price", "weight"))

:
: st_sview(X,.,"make make2")
variable make make2 not found
              st_sview():  3500  invalid Stata variable name
                 <istmt>:     -  function returned error
r(3500);

:
: st_sview(X,.,("make", "make2"))

:
: end
----------------------------------------------------------------------------------------------------------------------------------------------------------

Execution in Stata 10.1

. version 10.1

.
. sysuse auto, clear
(1978 Automobile Data)

.
. generate make2=make

.
. mata
------------------------------------------------- mata (type end to
exit) --------------------------------------------------------------------------------------
:
: X=1

:
: st_view(X,.,"price weight")
variable price weight not found
               st_view():  3500  invalid Stata variable name
                 <istmt>:     -  function returned error
r(3500);

:
: st_view(X,.,("price", "weight"))

:
: st_sview(X,.,"make make2")
variable make make2 not found
              st_sview():  3500  invalid Stata variable name
                 <istmt>:     -  function returned error
r(3500);

:
: st_sview(X,.,("make", "make2"))

:
: end
----------------------------------------------------------------------------------------------------------------------------------------------------------------
*
*   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