12-08-2014 08:28 AM
I am working with EXCEL AMO. In the AMO I want to create a button which could open the PDF report from SAS library (or SAS generated report in any other format).
That's why I want to write a SAS code which could open a pre-generated report.
x "path/abc.pdf"; is one possible option to open a pdf file from SAS code but this code does not work in SAS AMO
12-08-2014 08:49 AM
Well, assuming the AMO means the SAS Office plugin, I would assume that your "button" would be an office one and that you would need to use VBA to open something.
Have a look at: Open PDF file in Excel with VBA - Stack Overflow
12-08-2014 09:16 AM
Thanks for your reply.
I really don't know much about AMO. I just started using it recently. But if leave excel out of the picture then just consider the case where I want to open a PDF report using SAS code. Is is possible somehow ?
In simple words what I am trying to ask is: Is there any alternative of following statement in SAS ?
12-08-2014 09:30 AM
Not that I know of. A PDF is a proprietary format, normally binary. It requires a reader to open and parse the information, and then to render it. What you are doing with the X command is actually loading and exe file provided by Adobe with a parameter to your file. That software then opens and renders the contents. Its not actually Excel or SAS, just need a way of running the reader exe and being able to pass a network location/filename in as a parameter to that exe, somthing like
12-08-2014 09:45 AM
You are right about it.
Basically x "\\network\temp\your_file.pdf" this code would also works in Windows as it just asks the windows to open the pdf file location at the path(through shell). But since I have to link this code to Excel and Excel doesn't allow me to use "x" commands.
That is why I was asking a alternative to "x" statement.
12-08-2014 01:10 PM
Normally, if I go to Excel and do a simple File --> Open, I cannot just open a PDF file (see screen shot). So adding SAS to the mix is not going to change the fundamental nature of Excel. By default, when you run stored processes (for example), every client application (such as AMO) can only "receive" certain kinds of stored process results. Excel, for example, can only "accept" CSV, HTML and SASReport XML output from a stored process. PowerPoint, for example, can ONLY read SASReport XML. Word can receive RTF, HTML and SASReport XML from a stored process.
So I am not sure that an X command will help you with what you want to do.
12-08-2014 01:41 PM
Thanks for your reply. Information provided by you is helpful but I think I didn't explain my doubt properly. What I want is to implement a button in Excel which could open pre-generated reports(pdf, html, rtf-anything would work for me) from SAS defined library. I know that PDF file can not be open using excel as browser. I don't care whether these reports gets opened in excel or their particular browser (e.g Adobe reader for pdf, Word for rtf etc). I just want that on clicking this button should open reports which are located in predefined sas library in any browser (let say chrome for html or adobe reader for pdf). That is why I was trying to use 'x' statement to open a pdf file from SAS.
12-08-2014 06:10 PM
The only files you can access from a "SAS defined library" are SAS datasets and files, like catalog files. Although you can open pre-defined SAS Report files, those do NOT include PDF, RTF or other files that are intended to be opened by 3rd party applications. The idea of making a "button" in Excel is more of a VB/VBA/.NET concept than a SAS concept. You can pull data from SAS into Excel, because data in SAS libraries is defined in the metadata --and there are already buttons on the Add-in ribbon that allow you to open or point to SAS data files. Then, there is a Reports button that allows you to run a stored process. But as far as putting a button inside Excel to open ANY kind of file, including RTF and PDF seems to me to be an Excel automation question and not a SAS question.
12-08-2014 06:41 PM
Its my understanding that the SAS AMO interface is designed to surface SAS content into the Microsoft tool it is being called from, so rows and columns into Excel, text-style reports into Word, XML-based reports into Powerpoint, not to display other content "on the side".
In other words you are trying to do something with AMO that it was never designed to do. If you are simply wanting a SAS tool that will interface with pre-generated reports, then I suggest you look at SAS Web Report Studio.