# st: Parse (translate equalities into linear transformation matrix)

 From "Jun Xu" To statalist@hsphsun2.harvard.edu Subject st: Parse (translate equalities into linear transformation matrix) Date Fri, 02 Apr 2004 07:32:58 -0600

Thanks to Nick's comments on syntax anything last time and I used several gettoken and equations get parsed. Now, I try to incorporate more comprehensive problems. A reminder of my problem and to make my problem more generic, I have d1, d2, d3...(k known number of functions derived from estimated of last estimation), and I like to test if the linear combination of d1...dk is equal to somthing, something like:
let's assume there is d1-d5

mytest 2*d1+(3+5)*d2/2+d5*_pi=0

I can successfully parse each element before or after + or negative sign, but I couldn't figure out how to parse 2*d1, 3*d2/2, d5*_pi into matrix. It seems to me there are too many ways of writing such expressions, thereby hard to parse. The end product that I what is two matrices:

The transformation matrix: [2, (3+5)/2, 0, 0, _pi]
The d matrix: [d1, d2, d3, d4, d5]'

Well, I can easily get d matrix because I can use some info in last estimation to derive them, but the key issue here is to grab numbers or numeric expressions in those equalities, peel off d1, d2,...d5, and turn the rest part into a transformation matrix. Any suggestions? Thanks a lot.

Jun Xu
Department of Sociology
Indiana University at Bloomington

_________________________________________________________________
Watch LIVE baseball games on your computer with MLB.TV, included with MSN Premium! http://join.msn.com/?page=features/mlb&pgmarket=en-us/go/onm00200439ave/direct/01/

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