Numeric operator and string data

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Jason, EViews Moderator, EViews Pamela

ral
Posts: 23
Joined: Tue Oct 21, 2014 2:44 pm

Numeric operator and string data

Postby ral » Wed May 06, 2015 8:10 am

Hi,

I am running a program that loads data into Eviews country by country and computes indices using the data. I added a series (PMI) that uses #N/A N/A to indicate missing values. The program works fine for one country (the United States), but I get the error message:

Numeric operator applied to string data function @MEAN in "GENR PMISTD=(PMI-@MEAN(PMI))/@STDEV(PMI)"

for the next country in the loop (the Eurozone) when I try to standardize PMI. What is odd is that the U.S. series also has missing values indicated in exactly the same way as the Eurozone -- i.e., it uses #N/A N/A.

Any idea about what is causing this problem?

Thank you.

Ron

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

Re: Numeric operator and string data

Postby EViews Gareth » Wed May 06, 2015 8:34 am

Hard to say without seeing it.

But you can probably convert the alpha series into a numerical one by using:

Code: Select all

series pmis = @val(pmi)
Follow us on Twitter @IHSEViews

ral
Posts: 23
Joined: Tue Oct 21, 2014 2:44 pm

Re: Numeric operator and string data

Postby ral » Wed May 06, 2015 8:48 am

Thank you for the quick reply. I get an error with the @val function:

Numeric argument passed to string @VAL function in "SERIES PMI1=@VAL(PMI)

This presumably happens because there are non-missing numerical data included in the series.

The Excel spreadsheet and the program are attached. The relevant sheets in the workbook are us_eviews and ez_eviews, and the PMI data are in column H.

You can also see in the Eviews workfile that Eviews recognizes the PMI data as a series for the US and as alphanumeric for the Eurozone. And yet both PMI series are, as far as I can tell, identically formatted in the spreadsheet.

Thanks again for your help.

Ron
Attachments
cai_pmitest.prg
(5.67 KiB) Downloaded 40 times
cai_data.xlsx
(1.35 MiB) Downloaded 75 times

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

Re: Numeric operator and string data

Postby EViews Gareth » Wed May 06, 2015 9:00 am

use:

Code: Select all

   import(type=excelxml) {%excelname}  range={%x}_eviews types=(w, w, w, w, w, w,w, f, w, w) @freq m %start
Follow us on Twitter @IHSEViews

ral
Posts: 23
Joined: Tue Oct 21, 2014 2:44 pm

Re: Numeric operator and string data

Postby ral » Wed May 06, 2015 9:08 am

I replaced this line in the program:

import(type=excelxml) {%excelname} range={%x}_eviews @freq m %start

with this line:

import(type=excelxml) {%excelname} range={%x}_eviews types=(w, w, w, w, w, w,w, f, w, w) @freq m %start

I get this error now:

Syntax error: invalid format string in "IMPORT(TYPE=EXCELXML) CAI_DATA.XLSX RANGE=US_EVIEWS TYPES(W, W, W, W, W, W, W, F, W, W) @FREQ M "1986M1""

And interestingly the program runs fine when I include the PMI series from Japan.

Thanks.

ral
Posts: 23
Joined: Tue Oct 21, 2014 2:44 pm

Re: Numeric operator and string data

Postby ral » Wed May 06, 2015 1:56 pm

I solved the problem. My program worked for some countries but not others, and there did not appear to be a systematic pattern governing when it did not work. The issue may have something to do with Excel rather than Eviews.

I inserted this logical test into the cells from which I was loading the data into Eviews:

=if(istext(A1),NA(),A1)

It tests whether the entry in A1 is text. If so, the command assigns the cell #N/A, which Eviews recognizes as a missing value. Otherwise, it assigns the cell the numerical value contained in cell A1.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 6 guests