Subscribe Bookmark RSS Feed

Sending messages to multiple files

Hi Guys,

I have a set of files that I am modifying. The files are in a folder. My code is as follows:
I am trying to create a new column in all the files, however the dt command is working only on the first file.
I have other operations on the files too like transpose, create new transposed file, etc.

files = Files In Directory("C:\try");
Set Current Directory( "C:\try" );
While(Pat Match(files,"/","\"),1;);
for(i=1 i<= N Items(files) i++
Open(files[ i ];
dt = Open(files[ i ]),););



How do I get it to work within a loop so I don't have to manually change every file?

Thanks.

Message was edited by: jmpuseer
5 REPLIES
Ok how do I post code here without the html editor gobbling it up?
Forum markup post below.

http://support.sas.com/forums/thread.jspa?messageID=27609毙
<
files = Files In Directory("C:\try");
Set Current Directory( "C:\try" );
While(Pat Match(files,"/","\"),1;);
for(i=1 i<= N Items(files) i++
Open(files[ i ]);
dt = Open(files[ i ]),););
>

Message was edited by: jmpuseer
Still can't get it to work.
I am using pre and /pre.

Message was edited by: jmpuseer
mpb

Super User

Joined:

Jun 23, 2011

Try this: