[
Date Prev
][
Date Next
][
Thread Prev
][
Thread Next
][
Date index
][
Thread index
]
st: re: averaging within a variable
From
Kit Baum <
[email protected]
>
To
[email protected]
Subject
st: re: averaging within a variable
Date
Tue, 12 Jul 2005 22:50:54 -0400
And here is a pure Mata solution to that problem:
clear
set obs 100
g Var1=_n
mata:
v1=st_data(.,"Var1",0)
v3 = colshape(v1',2) * J(2,1,0.5)
res=st_addvar("float","Var2")
st_store((1,rows(v3)),res,v3)
end
list
This version will work for whatever number of observations are in Var1, as long as it is even.
Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
*
* 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/
Prev by Date:
RE: st: re: averaging within a variable
Next by Date:
st: Using the mark/markout commands
Previous by thread:
st: RE: Re: Re: replacing a scalar from mat
Next by thread:
st: Using the mark/markout commands
Index(es):
Date
Thread
© Copyright 1996–2024 StataCorp LLC |
Terms of use
|
Privacy
|
Contact us
|
What's new
|
Site index