Transforming Alpha Series into Numeric

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

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

loulouviews
Posts: 60
Joined: Wed Mar 11, 2015 2:19 am

Transforming Alpha Series into Numeric

Postby loulouviews » Thu Mar 03, 2016 5:37 am

Hi,

I'm currently facing the following problem:
I'm reading data from an html table. NAs in that table are encoded in two ways : either with blank or with "NaN".
When reading that table into EViews, EViews is interpreting the series containing NaN as alpha series.
I've tried to do :

Code: Select all

wfopen(type="html") %url colhead=2 namepos=first na="NaN"
but it didn't worked.
I've tried to a loop amid the imported series to transform the alphas to numeric with :

Code: Select all

group _g for !i=1 to _g.@count %name = _g.@seriesname(!i) {%name}=@val({%name}) next
But as all the series are not alphas, I got a "Numeric argument passed to string @VAL function" error when %name is a numeric series.
I've also tried

Code: Select all

group _g for !i=1 to _g.@count %name = _g.@seriesname(!i) {%name}=@recode({%name}="NaN",na,{%name}) next
But it didn't worked either.

So how can I tell EViews that NAs can be either blanks or "NaN" ?
Or find a way to check if a series is alpha or not with a @isalpha kind of function ?


Thanks for your help.

Loulouviews

loulouviews
Posts: 60
Joined: Wed Mar 11, 2015 2:19 am

Re: Transforming Alpha Series into Numeric

Postby loulouviews » Thu Mar 03, 2016 7:55 am

I finally end up doing

Code: Select all

group g_all * for !kk=1 to g_all.@count %name=g_all.@seriesname(!kk) if {%name}.@type="ALPHA" then rename {%name} _temp series {%name}=@val(_temp) delete _temp endif next delete g_all
If anyone has a more parsimonious and elegant solution, I'm eager to hear about it.
Thanks

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

Re: Transforming Alpha Series into Numeric

Postby EViews Gareth » Thu Mar 03, 2016 8:44 am

Use @wlookup


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 2 guests