How to up/down elements in Vector?

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

farrel
Posts: 108
Joined: Thu Sep 18, 2008 11:13 pm

How to up/down elements in Vector?

Postby farrel » Thu Feb 09, 2023 3:46 am

Dear Eviews,

Do you have any function that does up/down sorting of elements in vector? but not ascending/descending sorting ..
Here an example. I have to vecs. I want to sort up/down the VEC2, so later to make element by element multiplication using @emult(Vec1,Vec2)
pic.png
pic.png (10.61 KiB) Viewed 3039 times
Thanks
Andrejs

EViews Matt
EViews Developer
Posts: 570
Joined: Thu Apr 25, 2013 7:48 pm

Re: How to up/down elements in Vector?

Postby EViews Matt » Thu Feb 09, 2023 3:52 pm

Hello,

It appears you want to reverse the vector. While EViews doesn't provide a reversing function, you can achieve the same result via other operations, e.g.,

Code: Select all

VEC2 = @capplyranks(VEC2, @seq(VEC2.@rows, -1, VEC2.@rows))

farrel
Posts: 108
Joined: Thu Sep 18, 2008 11:13 pm

Re: How to up/down elements in Vector?

Postby farrel » Thu Feb 09, 2023 11:38 pm

Dear Matt,
great. many thanks. it works!
I also was spinning "@capplyranks", but without success, but you made it :)

Andrejs


Return to “Programming”

Who is online

Users browsing this forum: Baidu [Spider] and 2 guests