# How to use a DO loop to generate a sample of an AR series

Hi all,

I tried to do some programming in Shazam, but I unfortunately I am stranded. I have the following problem that I’m struggling with: My objective is to generate a selected number of AR(1)-series by using the do-loop command on the following script (which only generates a single series):

```
SAMPLE 1 5
GENR YEAR = TIME(0)
GENR X2 = NOR(3)
GENR y = 1
GENR y = 1 + 0.2*LAG(Y) + X2
PRINT y year
```

Further – the problem is to store the n-AR(1) series in a n-column matrix and then be able to graph the series in a single figure and as well (optionally) separately (with the generated YEAR-variable on the x-axis). Great if I could get some help with the right SHAZAM -script which could sort this out :-)

Kind regards, TL