Page 1 of 2
Defining Path
Posted: Wed Jan 21, 2009 11:03 am
by fmgoto
Hey, I need to move (.prg) files quite often and I wonder if I could define a path-variable such as:
%path = "C:/Program Files/Eviews/2009-01-20/main.prg",
so that I could change the file path only once and it would change the path within every other code which are included in my main.prg.
How?
Thank You, Goto
Re: Defining Path
Posted: Wed Jan 21, 2009 11:11 am
by EViews Gareth
I think you're talking about the CD command?
Re: Defining Path
Posted: Fri Jan 23, 2009 11:56 am
by fmgoto
Sort of.
What if I need to read, write and save into a given folder?
cd "c/data/"
read(...) "c/data/subfolder/spreadsheet.xls" 2
write(...) "c/data/output/spreadsheet2.xls" y_hat
wfsave "c/data/subolder/spreadsheet3.xls"
Thanks!
Re: Defining Path
Posted: Fri Jan 23, 2009 12:30 pm
by EViews Gareth
Then I guess you can use replacement variables:
%savepath = "c/data/subolder/spreadsheet3.xls"
%writepath = "c/data/output/spreadsheet2.xls"
%readpath = "c/data/subfolder/spreadsheet.xls" 2
read %readpath 2
write %writepath y_hat
wfsave %savepath
or something along those lines.
Re: Defining Path
Posted: Fri Jan 23, 2009 2:01 pm
by fmgoto
That is (a lot) closer!
Except for I need to concatenate two strings: the whole path and the subfolder path. That is,
%path = "C:/.../"
read(...) %path + "spreadsheet.xls" 2
How do I concatenate the main %path and the subfolder + spreadsheet.xls within the same command (read, write or save). That is the question!
Thank you very much!
Re: Defining Path
Posted: Fri Jan 23, 2009 2:09 pm
by EViews Gareth
%path = "c:\...\"
%temppath = %path + "spreadsheet.xls"
read %temppath 2
Re: Defining Path
Posted: Fri Jan 23, 2009 2:26 pm
by fmgoto
GREAT! Thanks!
Re: Defining Path
Posted: Fri Apr 03, 2009 5:53 am
by fmgoto
Gareth, I'm back again!
We are working with Eviews in Brazil and there are some special characters Eviews does not recognizes when running from the command prompt. Surprisingly, that is not an issue when running the exact same code line by line.
I wonder if there is some ASC or ANSI to EVIEWS table so that I could turn "ÁÂÃ" into something that and Eviews.prg would read without haulting.
Thank You, Fábio, with an Á!
Re: Defining Path
Posted: Fri Apr 03, 2009 2:26 pm
by EViews Gareth
In general EViews has dodgy handling of special characters. To be honest you're probably best off trying not to use them.
Re: Defining Path
Posted: Tue Aug 18, 2009 6:04 am
by fmgoto
What if I need to specify paths that include spaces (" "), such as "C:/Program Files".
%root = "C:\Program Files"
%month = "2009_08"
%folder = %root + %month
cd %folder
The thing, though, is that the "cd %folder" command considers "C:\Program " as the root folder, since there is a space between "Program" and "File". Thus, Eviews cannot read the %folder string as I would like it to read.
I tried the double "" trick, but it didnot work either.
Thanks, Fabio
Re: Defining Path
Posted: Tue Aug 18, 2009 7:39 am
by fmgoto
Got it!
%aspas = """"
%folder = "C:\Program Files\"
%subfolder = "2009_05"
%path = %aspas + %defaule_folder + %subfolder + %aspas
cd %path
Thanks!
Re: Defining Path
Posted: Fri Jun 08, 2012 10:18 am
by tho_mi
Sorry for digging out this old thread, but i don't want to create a new one.
I have just one short question, is there a possibility to do the concatenation without the intermediate step with a temporary variable?
Re: Defining Path
Posted: Fri Jun 08, 2012 10:28 am
by EViews Gareth
Generally, no.
Re: Defining Path
Posted: Fri Jun 08, 2012 10:32 am
by tho_mi
Generally, no.
Ok, thanks.
Re: Defining Path
Posted: Mon Jun 16, 2014 12:33 pm
by gio.ortolani
Is there a way to concatenate a string to a scalar with replacement variables?