Statalist


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

Re: st: RE: help with mata's st_sview


From   Mike Wazowski <[email protected]>
To   [email protected]
Subject   Re: st: RE: help with mata's st_sview
Date   Sat, 4 Jul 2009 11:13:38 -0700 (PDT)

thanks martin, i missed that, now i got it working :)
mike




--- On Sat, 7/4/09, Martin Weiss <[email protected]> wrote:

> From: Martin Weiss <[email protected]>
> Subject: st: RE: help with mata's st_sview
> To: [email protected]
> Date: Saturday, July 4, 2009, 3:11 PM
> 
> <>
> 
> As -help mf_st_view, mark(remarks5)- says: "Assignment does
> not cause
> promotion." Note that you execute Stata commands, such as
> the -recast-
> command,  from within -mata- as in - help mata stata-
> 
> 
> 
> 
> HTH
> Martin
> 
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]]
> On Behalf Of Mike Wazowski
> Sent: Samstag, 4. Juli 2009 05:43
> To: [email protected]
> Subject: st: help with mata's st_sview
> 
> dear statalisters,
> 
> i am puzzled by the following behavior:
> 
> i use st_sview to access a stata variable and change it
> internally within
> mata.  however, i am not able to "stretch" a string
> variable above its
> storage type, for example, "make" in auto.dta is stored as
> str18 but if i
> want to change it within mata to something longer than 18
> chars, the new
> string gets truncated to 18 chars.  the following code
> illustrates this
> behavior:
> 
> sysuse auto, clear
> keep in 1/5
> list make
> d make
> mata:
> st_sview(x,.,"make")
> x[.,.]=x*2
> x
> end
> list make
> replace make = "01234567890123456789" in 1
> list make
> 
> as you can see, when i issue -replace- in stata, "make" is
> automatically
> promoted to str20.
> 
> how can i promote a sting var from within mata to a longer
> string?
> 
> thanks,
> 
> mike
> 
> ps. the same behavior happens with st_sstore:
> 
> sysuse auto, clear
> keep in 1/5
> list make
> d make
> mata:
> st_sstore(2,"make","01234567890123456789")
> end
> list make
> 
> 
> 
> 
> 
> 
> 
>       
> 
> 
> *
> *   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/
> 


      


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