file paths with spaces

For questions regarding programming in the EViews programming language.

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

Jonathan
Posts: 5
Joined: Mon Sep 14, 2015 12:45 pm

file paths with spaces

Postby Jonathan » Tue Sep 22, 2015 10:12 am

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

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

Re: file paths with spaces

Postby EViews Gareth » Tue Sep 22, 2015 11:04 am

You need to put quotes around the %curr_path.
Something like:

Code: Select all

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

Jonathan
Posts: 5
Joined: Mon Sep 14, 2015 12:45 pm

Re: file paths with spaces

Postby Jonathan » Tue Sep 22, 2015 11:45 am

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


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests