01-21-2014 02:36 PM
I have some SAS code that writes out to an excel workbook located on a windows server. SAS is running on a linux server.
Is it possible to have SAS copy and paste that workbook with a different name on the windows server? Basically the workbook is a template that gets populated and I want to be able to run the code multiple times and end up with multiple populated templates. The way it's structured now after each run I have to copy out the populated template and put another blank one in the location.
01-21-2014 08:38 PM
So I could just set my two filenames using PCFILES and then run this macro? Will there be any issues because these are macro enabled workbooks with macros and lots of formulas, not just simple excel worksheets?
01-21-2014 02:55 PM
I think your best bet is to have SAS submit a DOS command to copy / rename the file before you populate data. I don't think there should be any difficulty accessing the file as long ans the directories are available to the system running the command.
01-21-2014 08:35 PM
The only way I've seen to have SAS submit DOS commands is with x. How do I use x while also telling it to run the command on a different server than where SAS is installed?
01-21-2014 09:53 PM
I like unnamed pipe for executing OS commands. You have good control of the output and you can use FILEVAR= option to execute a number of different commands in the same data step.
01-22-2014 01:55 AM
So you're recommending that I use unnamed pipe to copy and rename the file with windows command line? Are there any limitations to this being that I need to use the pipe on a different server than where SAS is running? I've started googling but had never heard of this before so more detail would be helpful.
01-22-2014 07:44 AM
You said you only knew of X command to execute DOS commands. I was suggesting PIPE because you have greater control over the output from each command this is executed.
You don't have to use the FILENAME statement you can also use pipes with the FILEVAR option which allows a single data step to "do it all".
What is the command that you need to execute?
01-23-2014 11:53 PM
The command I want to execute would copy a file (leaving it in the same directory) and then rename it. So with the pipe method I can use a filename statement (which I can define as on a different server, correct?) and have the command in there? Am I understanding this right? Thanks for your help!
I'm really not sure how to go about getting the result I desire. My SAS code already writes out to the workbook correctly, but I want to add something so after it writes out that work book gets copied and has a different name.
01-24-2014 07:57 AM
I don't understand your parentheticals.
I don't know if this example will be helpful or not but it is the kind of thing I am talking about. It is submitted from EG on a unix server.