How to crate a Series of Integers
How to crate a Series of Integers
Hello everybody,
I would like to create a series of integers for example a Series which contains the number 22 as an integer values for each entry.
My idea was:
declare SERIES[Integer] onem
set onem = 22
But then the following error occurs:
SX22. Expected Type SERIES[REAL], Got SERIES[INTEGER] Instead
How can I fix that problem?
Thank you for your help
Jules
I would like to create a series of integers for example a Series which contains the number 22 as an integer values for each entry.
My idea was:
declare SERIES[Integer] onem
set onem = 22
But then the following error occurs:
SX22. Expected Type SERIES[REAL], Got SERIES[INTEGER] Instead
How can I fix that problem?
Thank you for your help
Jules
Re: How to crate a Series of Integers
You have to use GSET for any SERIES type other than SERIES[REAL] (or SERIES[COMPLEX] which is done with CSET).
dec series[integer] s
gset s rstart rend = f=StateF(t),%ranbranch(||p*f(1),(1-p)*f(2)||)
dec series[integer] s
gset s rstart rend = f=StateF(t),%ranbranch(||p*f(1),(1-p)*f(2)||)
Re: How to crate a Series of Integers
Hey thank you very much!!
And I have one more question.
I want to transform a Real into an Integer. How do I do that? My code is:
compute lags = 22
display lags
fix(lags)
but then the following error occurs:
## OP3. This Instruction Does Not Have An Option P
>>>>fix(p)<<<
Thank you very much
And I have one more question.
I want to transform a Real into an Integer. How do I do that? My code is:
compute lags = 22
display lags
fix(lags)
but then the following error occurs:
## OP3. This Instruction Does Not Have An Option P
>>>>fix(p)<<<
Thank you very much
Re: How to crate a Series of Integers
As you have that written, FIX(p) is a separate instruction. I'm not sure what you're trying to do in the code above, but
compute lags=fix(sqrt(500))
would make LAGS an integer that's the first value less than sqrt(500).
compute lags=fix(sqrt(500))
would make LAGS an integer that's the first value less than sqrt(500).
Re: How to crate a Series of Integers
I create a real:
Computer lags = 22.000
And want to Transform it to an integer:
Compute lags1 = fix(lags)
Such that
Display lags1 -> 22 instead of 22.000 and the Programm should notice that lags1 is an integer
Is the Code right?
Thanks
Jules
Computer lags = 22.000
And want to Transform it to an integer:
Compute lags1 = fix(lags)
Such that
Display lags1 -> 22 instead of 22.000 and the Programm should notice that lags1 is an integer
Is the Code right?
Thanks
Jules
Re: How to crate a Series of Integers
Yes. You just wanted (in the original question)
disp lag fix(lags)
with the fix(lags) on the same line, not a second line.
disp lag fix(lags)
with the fix(lags) on the same line, not a second line.
Re: How to crate a Series of Integers
Thanks you very much Tom.
Best jules
Best jules