@wdrop statement

For questions regarding programming in the EViews programming language.

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

Andre2016
Posts: 12
Joined: Thu Sep 01, 2016 4:47 pm

@wdrop statement

Postby Andre2016 » Fri Sep 23, 2016 1:07 pm

Hello Guys,

So I have the following code :

Code: Select all

smpl @all genr bbmodel = bbdmodel alpha bbmodel @wdrop ("Astra 1125SP" , "SP") @wdrop ("Astra 1125SPX" , "SPX")
Is there a way to write it so that I don't have to revrite the @wdrop statement on every single line?

Thanks

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

Re: @wdrop statement

Postby EViews Gareth » Fri Sep 23, 2016 1:47 pm

Currently those lines are not doing anything, so hard so see what you mean.

Andre2016
Posts: 12
Joined: Thu Sep 01, 2016 4:47 pm

Re: @wdrop statement

Postby Andre2016 » Mon Sep 26, 2016 11:23 am

Currently those lines are not doing anything, so hard so see what you mean.
I have a series called "bbmodel" which is an alpha series that I'd like to edit.

In that alpha series I'd like the following action:

If what appears is "Astra 1125SP" then I'd like it to be only "Astra 1125"
If what appears is "Astra 1125SPX" then I'd like it to be only "Astra 1125"

Thanks

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

Re: @wdrop statement

Postby EViews Gareth » Mon Sep 26, 2016 11:34 am

Code: Select all

bbmodel = @replace(bbmodel, "SPX", "")

Andre2016
Posts: 12
Joined: Thu Sep 01, 2016 4:47 pm

Re: @wdrop statement

Postby Andre2016 » Mon Sep 26, 2016 11:37 am

Code: Select all

bbmodel = @replace(bbmodel, "SPX", "")
Thanks Gareth,

Andre2016
Posts: 12
Joined: Thu Sep 01, 2016 4:47 pm

Re: @wdrop statement

Postby Andre2016 » Tue Oct 04, 2016 1:27 pm

Code: Select all

bbmodel = @replace(bbmodel, "SPX", "")
I have an issue.

when I do

Code: Select all

bbmodel = @replace(bbmodel, "Falcon 200", "Falcon 20")
All the values containing "Falcon 200***" changes e.g:

Falcon 2000S becomes Falcon 200S

Is there a solution so that when I change "Falcon 200" to "Falcon 20", everything else remain the same ?

Thnks

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

Re: @wdrop statement

Postby EViews Gareth » Tue Oct 04, 2016 2:01 pm

If there are spaces after the 200, you could include a space in the replace.

Otherwise you'll have to do a search replace with @instr, @left, @mid etc...


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests