# st: Re: scalar for arima regression and generating new variables

 From "Martin Weiss" To Subject st: Re: scalar for arima regression and generating new variables Date Thu, 30 Oct 2008 22:44:10 +0100

```On that second part: Not sure why you want the medians there but anyway

*******
clear*
set obs 1000
g x=runiform()
g y=rnormal()
g z=rchi2(3)
g medians=.
su x,d
replace medians=r(p50) in 1
su y,d
replace medians=r(p50) in 2
su z,d
replace medians=r(p50) in 3
l in 1/3
*******

Might also want to look at -h collapse-

HTH
```
Martin _______________________ ----- Original Message ----- From: "Christian Vorbeck" <christianvorbeck@gmail.com>
```To: <statalist@hsphsun2.harvard.edu>
Sent: Thursday, October 30, 2008 9:29 PM
Subject: st: scalar for arima regression and generating new variables

```
```Hello,
let me begin by saying i am just learning stata, and that the answer
to this question is likely quite simple but i can't seem to find it. I
am running a series of arima equations and would like to save the
resulting coefficients (for lags 1 and 2). I have used scalar k0 =
_coef[_cons] to save the constant but can't figure out how to save the
lag's. I have tried scalar k1 = _coef [L1], [L1.] and [arL1] but they
don't seem to work.

Secondly, is there a way to create a new variable with one observation
from a couple of other variables? lets say for example i have x1
through x8 with 100 obs each, is there a way to create a variable with
one observation (or even the median) from each ( ie. X is a column
with x1, x2,...,x8). This would really save me a lot of time down the
road so any help would be greatly appreciated. Thanks,

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

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