Macro variable in calling SQL SP

For questions regarding programming in the EViews programming language.

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

MSQ1
Posts: 13
Joined: Fri Sep 17, 2010 7:18 am

Macro variable in calling SQL SP

Postby MSQ1 » Thu Dec 15, 2011 9:00 am

Hi,

I'm wondering if I can use a string variable when calling a SQL SP? I want the program to loop when it's fetching data for different dates.

Now I have:
wfopen(type=odbc) "tycheodbc" "{call spEXFGetClose ('2008-11-03')}" @keep *
where you enter the date manually each time

I want the program to do the analysis for X consecutive days, hence I would like to do something like:

%day_1= "2008-11-03"
%day_2= "2008-11-04"
...
%day_X= "2011-11-03"

for !i=1 to X
%day=%day_{!i}
wfopen(type=odbc) "tycheodbc" "{call spEXFGetClose ('{%day}')}" @keep *
next

where you don't have to enter the date and run the program manually X times.
/Maria

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

Re: Macro variable in calling SQL SP

Postby EViews Gareth » Thu Dec 15, 2011 9:10 am

Code: Select all

for !i=1 to X %day=%day_{!i} %command = """{call spEXFGetClose ('" + %day + "')}""" wfopen(type=odbc) "tycheodbc" {%command} @keep * next
or something along those lines


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 1 guest