Defining Path
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
Defining Path
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
%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
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Defining Path
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!
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!
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Defining Path
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.
%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.
Follow us on Twitter @IHSEViews
Re: Defining Path
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!
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!
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Defining Path
%path = "c:\...\"
%temppath = %path + "spreadsheet.xls"
read %temppath 2
%temppath = %path + "spreadsheet.xls"
read %temppath 2
Follow us on Twitter @IHSEViews
Re: Defining Path
GREAT! Thanks!
Re: Defining Path
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 Á!
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 Á!
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Defining Path
In general EViews has dodgy handling of special characters. To be honest you're probably best off trying not to use them.
Follow us on Twitter @IHSEViews
Re: Defining Path
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
%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
Got it!
%aspas = """"
%folder = "C:\Program Files\"
%subfolder = "2009_05"
%path = %aspas + %defaule_folder + %subfolder + %aspas
cd %path
Thanks!
%aspas = """"
%folder = "C:\Program Files\"
%subfolder = "2009_05"
%path = %aspas + %defaule_folder + %subfolder + %aspas
cd %path
Thanks!
Re: Defining Path
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?
I have just one short question, is there a possibility to do the concatenation without the intermediate step with a temporary variable?
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13315
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Defining Path
EViews Gareth wrote:Generally, no.
Ok, thanks.
-
- Posts: 14
- Joined: Wed Apr 25, 2012 7:34 am
Re: Defining Path
Is there a way to concatenate a string to a scalar with replacement variables?
Who is online
Users browsing this forum: No registered users and 20 guests