views:

94

answers:

1

I have a SAS file handle created as such:

filename filehandle "report.htm";

I have several files (packed Javascript files) which have very long lines (>32K in length). I would like a way to append their contents to the file above.

I know that if I do:

data _null_;
    file filehandle;
    put "very long string here";
run;

Sometimes, the very long string has line breaks inserted, which I don't want since it could break the Javascript code.

Ideally, something like:

x "cat packed.js >> report.htm";

would work well but I only have the file handle, not the original file path.

What routines could help me accomplish the job efficiently? Is there some way to read the packed JS file and write them out using put, either line by line or character by character?

Thanks!

+3  A: 

You can retrieve the full path from the file handle using the pathname function then use the x command as you wanted to.

For example:

data _null_;
  filenm=pathname('filehandle');
  call symput('filenm',filenm);
run;

x "cat packed.js >> &filenm.";
cmjohns
ah didn't know of a pathname function. thanks!