Hi,
Is it possible to assign a string variable to an element in a matrix?
The code fragment that I have written is below. I would like the output to be a 7xN matrix (N=2 in the fragment below) where the top row contains the names of the variables in the group (i.e., EURUSD and USDJPY) and the rows of the matrix contain statistics obtained from the regression (i.e., bhat) for each variable.
As it is written now, the code returns the error: Syntax error in "XRATES_RESULTS(1,1)="
Thank you.
group xrates_g EURUSD USDJPY
scalar N = xrates_g.@count
matrix(7,N) xrates_results
for !i=1 to N
%x=xrates_g.@seriesname(!i)
genr dl{%x}=100*(log({%x})log({%x}(1)))
equation {%x}eq.ls(cov="hac") dl{%x} c dussw2
alpha sername=%x
xrates_results(1,!i) = 'sername'
xrates_results(2,!i) = c(2)
next
Assigning string variable to matrix element
Moderators: EViews Gareth, EViews Jason, EViews Moderator

 Fe ddaethom, fe welon, fe amcangyfrifon
 Posts: 11811
 Joined: Tue Sep 16, 2008 5:38 pm
Re: Assigning string variable to matrix element
Matrices can only hold numbers. If you really want to hold text and numbers, use a table.
Follow us on Twitter @IHSEViews

 EViews Developer
 Posts: 2590
 Joined: Wed Oct 15, 2008 9:17 am
Re: Assigning string variable to matrix element
This may not be enough for your needs, but you can set row labels for a matrix using the setrowlabels matrix proc. These labels are not a part of the matrix.
Who is online
Users browsing this forum: No registered users and 6 guests