Hello!
Anyone know how to get the single element of series to scalar. I'm trying to do that with the @elem.
I've tryed the simple code in programing:
scalar j=1000
scalar element=@elem(mah02, j)
And don't work. So the question is how to get the value of teh series to scalar. (The n (1000) element of series or maybe the element by data (for example: 7/07/2014)).
The single element of series to scalar
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
The single element of series to scalar
- Attachments
-
- worfile_mah.wf1
- (36 KiB) Downloaded 354 times
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: The single element of series to scalar
scalar element=@elem(mah02, "2014/07/07")
Re: The single element of series to scalar
That's work well. And what if I need the value of the element 1000 (The element who is 1000 in the order in serie.) element of series.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: The single element of series to scalar
Use a otod to calculate the corresponding date
Re: The single element of series to scalar
Well the problem is because I need the scalar of "j" element in series because I'm trying to use scalar in for loop.;
!step=1
for !i =1000 to 1200 step !step
scalar j=!i
scalar element=@elem(mah02, j)
next
I need this for loop also because I will use scalar element in different sample for forecast. But this is a next step. First I want to know how I can use the @elem function. I know the algorithm for my final problem but I have a problems with program coding.
!step=1
for !i =1000 to 1200 step !step
scalar j=!i
scalar element=@elem(mah02, j)
next
I need this for loop also because I will use scalar element in different sample for forecast. But this is a next step. First I want to know how I can use the @elem function. I know the algorithm for my final problem but I have a problems with program coding.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: The single element of series to scalar
Code: Select all
%date = @otod(!i)
scalar element = @elem(mah02, %date)
Re: The single element of series to scalar
The code with j element of series works good. One another question. What if I need to change the single element of series. For example; If I need to replace the 12. element of series (who is now 234) to value 277. So, how to replace one single element of series with scalar.
@elem(series a, 12)=277
That's not work. They could be some other command, but I can't found them.
@elem(series a, 12)=277
That's not work. They could be some other command, but I can't found them.
-
startz
- Non-normality and collinearity are NOT problems!
- Posts: 3797
- Joined: Wed Sep 17, 2008 2:25 pm
Re: The single element of series to scalar
One, perhaps inelegant, way to do it is
Code: Select all
smpl 12 12
a =277
'restore old smplRe: The single element of series to scalar
That is very elegant solution, but anyone know if exist some command for that.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13603
- Joined: Tue Sep 16, 2008 5:38 pm
Re: The single element of series to scalar
Code: Select all
a(12) = 277
Re: The single element of series to scalar
I will use both solutions.
Who is online
Users browsing this forum: No registered users and 2 guests
