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.
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?
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.
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?
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.
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.
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?
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.
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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.