replace string data

For questions regarding programming in the EViews programming language.

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

arnoudbl
Posts: 2
Joined: Sat Jan 18, 2014 9:48 am

replace string data

Postby arnoudbl » Sat Jan 18, 2014 10:00 am

He all,

I got a question concerning the replacement of string data, when replacing data i usually insert i.e. k3h=@recode(k3h=na,0,k3h), however i need to replace Don't know. When commanding k3h=@recode(k3h="Don't Know",0,k3h) it responses with 'Numeric operator applied to string data'. Pleace help, i appreciate the effort!

Arnoud

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: replace string data

Postby startz » Sat Jan 18, 2014 10:46 am

Assuming that k3h is an alpha series, this strikes me as a bug. But try

Code: Select all

series k3hEqualsDontKnow = k3h="Don't know" k3h=@recode(k3hEqualsDontKnow ,0,k3h)

EViews Glenn
EViews Developer
Posts: 2682
Joined: Wed Oct 15, 2008 9:17 am

Re: replace string data

Postby EViews Glenn » Sat Jan 18, 2014 9:04 pm

I'm not by my computer so I can't test this but I think the second argument needs to be a string, as in

Code: Select all

k3h=@recode(k3h="Don't Know","0",k3h)

arnoudbl
Posts: 2
Joined: Sat Jan 18, 2014 9:48 am

Re: replace string data

Postby arnoudbl » Sun Jan 19, 2014 5:40 am

@ eviewsglen & startz

Thanks a lot for the effort, unfortunately both answers do not solve the issue... any other thoughts?

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

Re: replace string data

Postby EViews Gareth » Sun Jan 19, 2014 7:58 am

Post your work file

startz
Non-normality and collinearity are NOT problems!
Posts: 3798
Joined: Wed Sep 17, 2008 2:25 pm

Re: replace string data

Postby startz » Sun Jan 19, 2014 8:21 am

Glenn's solution works on my machine. If k3h is an alpha series, you can't set it to 0 because that's a number rather than a string.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests