Page 1 of 1

Using strings

Posted: Mon Apr 11, 2011 11:27 am
by PacNW
I have a program that uses a specific word string in the options section of wfopen, in the range command in the wfopen line, in the close command, in the wfcreate command, in the group command, in the write command, in the pagesave command, and in the wfsave command

For example:

wfopen(wf=Alpha) "C:\a.xlsx" range=alpha!a1 colhead=2 namepos=all @freq 7 12/1/2009

"Alpha" is used in that line and all of the typed of eviews commands I listed above.

Is it possible to run a loop that would do everything for Alpha, then run the program over for Beta, etc.?

Re: Using strings

Posted: Mon Apr 11, 2011 11:59 am
by EViews Gareth

Code: Select all

for %mystr "alpha" "beta" "gamma" wfopen(wf={%mystr} import(wf={%mtstr} next
etc...

Re: Using strings

Posted: Mon Apr 11, 2011 2:42 pm
by PacNW
Great, thanks!

Re: Using strings

Posted: Mon Apr 11, 2011 7:11 pm
by PacNW
This appears to work for all of the commands in my program with the exception of the WRITE command. The name of the output xls file ended up including %mystr, possibly because the name of the file was in quotes and enclosed the {%mystr}

Is there any way around this?

I'd like to write a new csv file for each loop of the program.

Using strings

Posted: Mon Apr 11, 2011 7:39 pm
by EViews Gareth
Create a new string equal to the full path:

Code: Select all

%path="c:\my path\" + %mystr + "\file.xls" Write %path

Re: Using strings

Posted: Mon Apr 11, 2011 8:06 pm
by PacNW
Thank you!