Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: replace an element in a matrix in stata


From   "Xu, Jun" <jxu@bsu.edu>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   st: replace an element in a matrix in stata
Date   Tue, 22 Jul 2008 19:28:12 -0400

dear stata listers,

i have a question about matrix functions in stata. if i have a matrix like
a = 1, 2, 3, 4, 5, 6
and I want to replace the third element 3 with another number, let's say 7 and turn a into 1, 2, 7, 4, 5, 6. Is there a function in stata that can help me achieve that. the problem here is i only know the dimension of the incoming matrix a, but i don't know what's exactly in a, a generic matrix. but i know what's to replace. if i knew a's contents, i would use some quasi identity matrix. any suggestions? thanks!

jun xu, phd
assistant professor
department of sociology
ball state university


*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index