Statalist


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

st: Extracting Matrices from dataset


From   "Nadeem Shafique" <[email protected]>
To   [email protected]
Subject   st: Extracting Matrices from dataset
Date   Mon, 20 Aug 2007 17:12:11 +0500

Respected All,

I wish to extract matrices based on a grouping varible in the dataset.
Consider the following example suppose I have three groups (1,2 and 3)
entered in "gr" variable
	
m	v1	v2 	v3	gr
**********************************
23	1	2	3	1
11	3	1	2	1
23	2	2	1	1

25	1	2	3	2
23	2	1	2	2
28	3	3	1	2

2	1	1	2	3
3	1	3	1	3
1	2	1	2	3

and i wish to extract three vectors say
	
	m_1=(23,11,23)

		m_2=(25,23,28)

			m_3=(2,3,1)

or I wish to extract three matrices say

v_1=(1,2,3\3,1,2\2,2,1)

	v_2=(1,2,3\2,1,2\3,3,1)

		v_3=(1,1,2\1,3,1\2,1,2)


similary if i have four groups then generated matrices or vectors
should be four and if i have five groups then the generated matrices
should be five and so on.


Best Regards,

Nadeem Shafique Butt
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index