Matrix to Series

For questions and discussion related to reading in and working with data.
ateeb
Posts: 65
Joined: Sat Mar 16, 2019 11:15 am

Re: Matrix to Series

Unread post by ateeb »

So about indexing, now i am getting this error:

## MAT13. Store into out-of-range %X(2015,23)
The Error Occurred At Location 898, Line 43 of loop/block

where i have 4 loops, 3 nested inside 1 of them:

The total lines of code I have is 698 lines -

So when it says Error is at location 898 how to locate that? and also when i count the lines 1 to 43 within the loop, should i ignore lines that have descriptions and start with *?

Regards,

Ateeb
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Matrix to Series

Unread post by TomDoan »

The "location" is unlikely to be much help. (We can use it in debugging the software, but it doesn't really help a user). The line count includes comments, and includes continuations---RATS has the line number in the status field at the bottom of the application windows so you just want to go 48 lines down from the DO.

What are you doing with %X? That's a throwback to version 3 or so.
ateeb
Posts: 65
Joined: Sat Mar 16, 2019 11:15 am

Re: Matrix to Series

Unread post by ateeb »

I found %X to be a good way to setup entries for my variables, I am having hard time understanding how to put variables in columns and observations in rows and doing operations on them ...
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Matrix to Series

Unread post by TomDoan »

If you're using %X to do data transformations, you're doing something wrong. You want to keep series as series as long as possible---in most cases, throughout the program. Matrices should be used when you are manipulating them as a whole, not element by element. The MAKE instruction can be used to create a specific matrix out of a specific range of a specific set of series when you need it (though often you don't even need that---instructions like CMOM and MCOV can create most of the important derived matrices without ever directly creating an "X" matrix).
Esteban
Posts: 10
Joined: Tue May 14, 2019 12:13 pm

Re: Matrix to Series

Unread post by Esteban »

Hi Tom and everybody,

Thanks for your answers. I have this doubt: How to turn a gset of vectors[2x1] into two different sets separately?. First, I tried doing a loop, but it seems to consume time computing unnecessarily.

Regards.
TomDoan
Posts: 7814
Joined: Wed Nov 01, 2006 4:36 pm

Re: Matrix to Series

Unread post by TomDoan »

Something like:

dec series[vect] asvects
gset asvects = %ranmat(2,1)
set series1 = asvects(t)(1)
set series2 = asvects(t)(2)
Post Reply