Subroutine arguments

For questions regarding programming in the EViews programming language.

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

DBel2012
Posts: 69
Joined: Sun Sep 30, 2012 5:37 am

Subroutine arguments

Postby DBel2012 » Tue Aug 13, 2013 10:56 am

Hello,

I'm using Eviews 7

I've got two questions :

I'm wrinting a sub which will have two arguments : Subroutine mySub(Series mySeries, Sample mySmpl)

1) while inside the sub, how can I assign the value of mySmpl to a string : %myRange = ????

2) Instead of passing a Series to my sub, Is it possible to pass a transformation of a series, i.e. passing @pch(variable) instead of passing variable?

Thanks!
Danny

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

Re: Subroutine arguments

Postby EViews Gareth » Tue Aug 13, 2013 11:04 am

1) is tricky. Something like:

Code: Select all

subroutine foo(sample mysmpl) %origsmpl = @pagesmpl 'store original sample smpl mysmpl 'set the current sample to be the sample object %myrange = @pagesmpl ' retrieve the string specification of the current sample smpl {%origsmpl} 'restore the original sample. endsub
To be honest, you're better off passing a string into the subroutine rather than a sample object. I personally never write subroutines that accept sample objects. Not worth the hassle.

2) Unfortunately not.

DBel2012
Posts: 69
Joined: Sun Sep 30, 2012 5:37 am

Re: Subroutine arguments

Postby DBel2012 » Tue Aug 13, 2013 11:09 am

Gareth,

Thanks a lot for the quick response, and also for the advice. Very much appreciated.

Danny


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests