# st: mata st_view( ) and change in stata data

 From Carl Nelson To statalist@hsphsun2.harvard.edu Subject st: mata st_view( ) and change in stata data Date Wed, 29 Nov 2006 15:58:18 -0600

The mata manual explains

st_view(X, ., ("mpg", "displ", "weight"))
X[2,1] = 123

will cause the second observation of mpg in stata to change.

I am trying to use mata to divide each row of 54 variables by their row
maximums. The mata code is

mata
st_view(a, .,(" over04"," over05"," expect04"," expect05"," repeat04"," repeat05"," othover04"," othover05"," clean04"," clean05"," meatqaul04"," meatqual05"," meatvar04"," meatvar05"," vegqual04"," vegqual05"," vegvar04"," vegvar05"," deliqual04"," deliqual05"," delivar04"," delivar05"," bakequal04"," bakequal05"," bakevar04"," bakevar05"," grocvar04"," grocvar05"," stock04"," stock05"," nature04"," nature05"," help04"," help05"," checkout04"," checkout05"," specserv04"," specserv05"," community04"," community05"," prices04"," prices05"," discount04"," discount05"," special04"," special05"," specsotck04"," specstock05"," loyalprice04"," loyalprice05"," loyalstock04"," loyalstock05"," location04"," location05"))
t = (0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\70\0\0\0\0\0\0\0\0\0\0\0\0\0)
a = a :+ t
r = rowscalefactors(a)
_equilr(a,r)
end

After I run this the matrix a in mata is correct, but the variables in the stata data set haven't been
changed.

I would appreciate any help correcting my error. Thanks.

Carl Nelson
ACE
UIUC
Urbana, Illinois

*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/