Replace na by * in matrix/table

For questions regarding programming in the EViews programming language.

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

andrekan
Posts: 2
Joined: Thu Jan 24, 2013 1:29 pm

Replace na by * in matrix/table

Postby andrekan » Mon Aug 05, 2013 3:40 am

Hi,

I load a matrix into EViews, then I convert it to a table and save it in LaTex format. My problem is that I want to replace missing values (na) by an asterisk, so I don't have to do this manually in the tex file after the conversion. Any ideas on how I could do it?

The relevant part of the code reads:

matrix(25,11) mat_Midwest_CI
mat_Midwest_CI.read(c2,s=For paper) "Analyses/Results\Time series\Midwest.xls"
freeze(tab_Midwest_CI_help) mat_Midwest_CI

I tried to use the @nan command to replace na values by * in the matrix, but it works for numeric variables only, i.e. writing @nan(mat_Midwest_CI, *) won't work. It doesn't seem like the @nan command works for the table either.

I'd be happy for all suggestions.

-André-

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Replace na by * in matrix/table

Postby EViews Gareth » Mon Aug 05, 2013 8:06 am

I think you'll have to loop through the elements of the table one by one checking whether they are equal to "NA", and if they are, replacing them with "*".


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests