Page 1 of 1

Looping in Fetch command

Posted: Mon Nov 11, 2013 10:10 am
by ttocont
I'm trying to loop through two strings in order to download series via Macrobond but can't figure out how to get the quotations marks and spaces correctly.

So for example, instead of:
fetch(d=mb) "ih:bl:ussw2 bgn curncy" "ih:bl:cdsw2 bgn curncy" "ih:bl:ussw5 bgn curncy" "ih:bl:cdsw5 bgn curncy" "ih:bl:ussw10 bgn curncy" "ih:bl:cdsw10 bgn curncy"

I am trying to do something like:

%BBG_swaps = "ussw cdsw"
%BBG_matyr = "2 5 10"
%bbg_start ="ih:bl:"
%bbg_fxend = " bgn curncy "

for %i {%BBG_swaps}
for %j {%BBG_matyr}
fetch(d=mb) {%bbg_start}{%i}{%j}{%bbg_fxend}
next
next


But from what I can tell of the error message, that seems to want to put a quote around the entire fetch command like:
"fetch(d=mb) "ih:bl:ussw2 bgn curncy"

Is there way to program this?

Thanks

Re: Looping in Fetch command

Posted: Mon Nov 11, 2013 10:22 am
by EViews Gareth
What you are doing looks like it should work.

Re: Looping in Fetch command

Posted: Mon Nov 11, 2013 10:30 am
by ttocont
When I run it I get the error message:

2 Objects were not found: MB::IH:BL:USSW2 MB::CURNCY in "FETCH(D=MB) IH:BL:USSW2 BGN CURNCY".

Re: Looping in Fetch command

Posted: Mon Nov 11, 2013 10:45 am
by EViews Gareth
Try this:

Code: Select all

for %i {%BBG_swaps} for %j {%BBG_matyr} %term = %bbg_start + %i + %j + %bbg_fxend fetch(d=mb) %term next next

Re: Looping in Fetch command

Posted: Tue Nov 12, 2013 12:41 am
by ttocont
That worked like a charm. Thanks!