Create and run SAS code in SAS Add-In for Microsoft Office


SAS programs in Excel, finally!When SAS Add-In for Microsoft Office was first created over a decade ago, SAS programmers were told to check their skills at the door. This new product was for non-programmers only. SAS programmers were invited to contribute to the experience by packaging their code in SAS stored processes, which end users would then run using point-and-click menus. But there was no way to write and run your SAS programs directly in Microsoft Excel or Word or PowerPoint.

This was a comfort to many SAS administrators, who wanted to provide SAS analytics to their end users but didn't want them to have to learn to program. Or perhaps to even allow them to program. But, times have changed. Citizen data scientists have been practicing their coding skills, and now they want to mix it up in Microsoft Office. In response to this demand, SAS R&D has added the SAS programming environment -- the parts that make sense, anyway -- into SAS Add-In for Microsoft Office. You can write programs, run them, and drop the results into any part of your Microsoft Office document.

Here's a short screencast of how it works in Microsoft Excel:

SAS programming in AMO

If you want to learn more and see a narrated demo from the principal developer, watch this interview with Tim Beese from SAS R&D. Tim shows the coding feature along with several other cool enhancements to SAS Add-In for Microsoft Office. As Tim explains, SAS administrators still have the final say when it comes to allowing Excel users to let loose with SAS code -- they can enable the feature by role, and so grant this as a privilege at their discretion.

The first few minutes of this video shows some impressive integration with SAS Visual Analytics and Microsoft Excel. The SAS programming demo begins around the 5-minute mark.


About Author

Chris Hemedinger

Senior Manager, SAS Online Communities

+Chris Hemedinger is the manager of SAS Online Communities. He's also co-author of the popular SAS for Dummies book, author of Custom Tasks for SAS Enterprise Guide using Microsoft .NET, and a frequent participant on the SAS Enterprise Guide discussion forum.

Related Posts


  1. Smart move, I like it already ! This is some kind of "official return" since there was back in 9.1 a custom task for the then current SAS Add-in which opened the Enhanced Editor inside Excel. It provides a nice workaround for enabling "advanced" data queries based on several tables with joins instead of basic single-table queries (the single table might be a view or Info Map statically joining tables, of course). Btw, thanks for the video, these "tech talk" series is really well made & easy to follow as take away. Pictures are more talkative than mere words on print.

    • Chris Hemedinger
      Chris Hemedinger on

      Glad you like it, Ronan! I created that custom task you reference, and we used it internally for lots of testing. Sometimes SAS Tech Support would supply it for special needs. I'm glad that we now have official support for this important capability!

      • I see, another secret weapon from the Q branch going public ^^. Thanks and well done,this is definitively useful.

  2. This has the potential to solve some platform issues and business conundrums we have with clients in the Agency/PR space. As Director of Product Management and Research there are specific business issues that can be solved by better integration between complicated SAS Code and the use of Microsoft Excel in smaller agencies. I will be reaching out to better understand what restrictions there will be and they can be overcome. I am actually local (Raleigh) , will there be any upcoming showcases on the SAS campus like there were when Visual Analytics was released a few years ago ?

  3. How come I never heard this before? Definitely not something we would used in regulated environment. At least, none of the companies I worked for have this add-on feature available.

  4. Hi Chris,

    Really interesting!!

    I want to know if its posible every kind of sentence...for example a libname sentence. I want to execute a libname to see a table that I have created in a library that I can't see when I open Excel and go to Add-in.

    Another question: from the Excel Add-in I can execute SAS E.G. tasks like graph or analysis tasks, but I want to know if I can execute data manipulation tasks.

    Last question: I am using a SAS dataset from Excel if I change the data in Excel, is it possible to send this changes to the original SAS dataset.

    Thanks in advance!!

    • Chris Hemedinger
      Chris Hemedinger on

      To answer you questions:
      - Yes, if you assign a libname by code then it should be available immediately in the SAS interface to Excel.
      - Data manipulation tasks? Yes, many of those tasks are available under the SAS tasks menus. The SAS Add-In does not have the full-blown Query Builder like EG, but many of the other tasks (like Rank, Standardize, Transpose, etc.) are available.
      - You can update SAS data from Excel. When viewing a SAS table, you'll see a "Begin Edit" button on the top of the screen (well, it will look different in Spanish). Click it to enter "edit mode" -- then click again to commit the changes and write them back to SAS.

Leave A Reply

Back to Top