Hello,
I'm having trouble getting Eviews to recognize my workfile's name, which contains a replacement variable, in the "open" and "save" commands. I realize that it's expecting a string in double quotes, but I don't understand why this generates an error (nor how I should be expressing the filename).
%var = jan_2011_update
open "data_file_"+%var+".wf1"
....[program code]....
wfsave(2) "data_file_"+%var+".wf1"
Many thanks,
R.
Replacement variable in double quoted string
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13600
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Replacement variable in double quoted string
Put them in a temporary string beforehand. Many EViews command won't accept string manipulation:
Code: Select all
%var = jan_2011_update
%fullname = "data_file_" + %var + ".wf1"
wfopen %fullname
wfsave(2) %fullname
Re: Replacement variable in double quoted string
Thanks, Gareth. That's what I've been doing, but it's getting a little cumbersome to create a new string variable every time I want to use the open or save files, or change the current directory (which happens multiple times throughout the program).
Does this imply that there's no way to directly insert a replacement variable into a quoted string?
Thank you,
R.
Does this imply that there's no way to directly insert a replacement variable into a quoted string?
Thank you,
R.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13600
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Replacement variable in double quoted string
Sort of. It implies that the wfopen and wfsave command will not let you do string arithmetic on their arguments. Inserting a replacement variable into a quoted string uses string arithmetic.
Who is online
Users browsing this forum: No registered users and 2 guests
