Open files using loop

Use this forum to post questions about syntax problems or general programming issues. Questions on implementing a particular aspect of econometrics should go in "Econometrics Issues" below.

Open files using loop

Postby kwangsooKo » Wed Jun 20, 2012 2:44 pm

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
Attachments
flow.zip
(48.26 KiB) Downloaded 38 times
kwangsooKo
 
Posts: 7
Joined: Tue May 22, 2012 2:36 am

Re: Open files using loop

Postby TomDoan » Wed Jun 20, 2012 2:56 pm

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.
TomDoan
 
Posts: 2720
Joined: Wed Nov 01, 2006 5:36 pm

Re: Open files using loop

Postby kwangsooKo » Thu Jun 21, 2012 4:26 am

Dear Tom,

Thanks for your helping.

Best Regards
kwangsooKo
 
Posts: 7
Joined: Tue May 22, 2012 2:36 am


Return to Help With Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron