Page 1 of 1

file paths with spaces

Posted: Tue Sep 22, 2015 10:12 am
by Jonathan
Hi,
This question is similar to that of the Defining Path thread although the responses there don't seem to be helping.

I'm trying to do something like this:

%curr_path = "Z:\Forecast_Sales\Results\0815\ABC August 2015 Sales Results.xlsx"
.
.
.
%half2 = " byrow colhead=2 namepos=last na=""#N/A"" @freq Q @id @date(variable) @destid @date @smpl @all"
for %tab " range=2015 Middle" " range=2015 Upside" " range=2015 Downside"
%command = """" + "import " + %curr_path + %tab + %half2 + """"
{%command}
next

But it doesn't work. I'm clearly not understanding the treatment of spaces and use of quotes. Any explanation or code suggestion or reference location would be appreciated. Thanks,
Jonathan

Re: file paths with spaces

Posted: Tue Sep 22, 2015 11:04 am
by EViews Gareth
You need to put quotes around the %curr_path.
Something like:

Code: Select all

%command = "import " + """" + %curr_path + """" +%tab + %half2 {%command}

Re: file paths with spaces

Posted: Tue Sep 22, 2015 11:45 am
by Jonathan
Thanks, that did it. I also hard-coded the range= and put double quotes around the tab name.

%command = "import " + """" + %curr_path + """" + " range=" + """" + %tab + """" + %half2

Thanks again,
Jonathan