Page 1 of 1

Open files using loop

PostPosted: Wed Jun 20, 2012 2:44 pm
by kwangsooKo
Dear Sir,

I am trying to create a do loop for opennig xlsx files.
I have three files that are composed of same series with different lengths, and each file’s name are a number 1, 2, and 3. I made programs but Something seems wrong.
Also I am trying to export residuals series as xls files named n.
I can click view/series windows/name of residuals/export .But I don’t know how can I export files in loop.

The following is my attempt:

do n=1,3
OPEN DATA "C:\Documents and Settings\n.xlsx"
DATA(FORMAT=XLSX,ORG=COLUMNS)
LINREG RT / U
# IF OI RT{1}
*export residuals series as xls files named n
end do n

Thank you very much for your time and help.

Regards

Re: Open files using loop

PostPosted: Wed Jun 20, 2012 2:56 pm
by TomDoan
See section 1.6 of the (RATS v8 ) User's Guide. The example there does

declare string fname
compute fname=%l(i)+".XLS"
open copy &fname
copy(format=xls,org=col,dates) / i

to open a file with a constructed name.

Re: Open files using loop

PostPosted: Thu Jun 21, 2012 4:26 am
by kwangsooKo
Dear Tom,

Thanks for your helping.

Best Regards