Friday, February 17, 2006

st: FW: grouping observations and performing cals

Hi all,

I have some data in the following format

Time     X

-5         2 -4         3 -3         2 -2         4 1          1 0          2 1          2 2          1 3          2 4          2 5          1

I need to compute y= Mean(X)/SD(X) for different time windows.

For example,

-5,-4 would be window 1 -3,-2 would be window 2 etc.

My present solution is this ( example for window 1)

Egen a=mean(X) if time>=-5 & time<=-4 (and so on for all the different windows)

Egen b=sd(x) if if time>=-5 & time<=-4 (and so on for all the different windows)

Gen y=a/b

Is there an easier way to do this???

Thanks very much

Regards rajesh

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


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?