I was wondering if it's possible to create a drop down list in SAS EG for export to excel. For example in my image below I would like to build a program where I can create a column which has a drop down list built into it when I export the data to an excel spreadsheet?
Any advice will help.
Regards
Daniel
You need write code :
ods _all_ close;
ods excel file='c:\temp\temp.xlsx' options(autofilter='all');
proc report data=sashelp.class nowd;
run;
ods excel close;
Sorry I should have explained it a bit better.
I want the ability to select 'Yes/No' as a list in empty cells not as a filter in the top row . Similar to when you create a list in excel. Any code that can make this happen?
Adding custom windows to EG is not possible, it is purely a SAS application development interface.
@AlanC - Thanks for the correction. I'd forgotten you can add custom tasks. However I suspect this would be like using a sledgehammer to crack a nut based on what the OP wants and given EG already has windowing interfaces for exporting to Excel.
Maybe @Cynthia_sas knows ?
Some older methods, none that I'd necessarily recommend.
https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Excel-data-validation/td-p/388441
Excel drop downs are called 'data validation' rules which can help with googling.
@DanielP91 how are you creating the Excel file currently?
Hi All
Thanks for the feedback. I am currently creating the excel file in SAS and exporting it with ODS proc report. Basically I want a unique column once the export is completed to have a data validation rule. This exported report will be used for data entry.
Very similar to what the link Reeza provided below.
https://communities.sas.com/t5/ODS-and-Base-Reporting/ODS-Excel-data-validation/td-p/388441
If this is currently not possible with SAS 9.4 then I will just add this data validation rule once the report is exported to excel.
Thanks Reez.
Yes this will mostly likely be a daily process. It think the solution mentioned below re running the method with VBS.
Currently run SAS EG from a server. X command?
I'm still unclear what you really want to achieve BUT if this is about creating an Excel that got a column with input validation as Excel drop downs then:
That's something I needed some time ago as well. As per my investigation it's not something that you can really do with SAS but you can do it with Python and it's no problem to call Python out of SAS, pass SAS data to Python and then have Python create the Excel. That's the way I've implemented this.
VBS is very deprecated. Do not use it for anything. PowerShell is a much better option if you go that route and it is easier to use. A custom task is the best but it requires some C# coding.
Too often, the idea is to do everything in SAS. As a Microsoft product, you can do much, much more in C# with Excel than you can in SAS. SAS is great at doing the ETL but then let the base technologies take over.
If you want 100% control for Excel, consider the custom task. If you only need some level of control, PowerShell can afford that. C# sits on .NET, EG is coded in .NET, and PowerShell is .NET: VBS/VBA/etc. are not. VBA and VBS were deprecated over a decade ago.
I am like the bearer of bad news on this thread: sorry. I have built numerous custom tasks in EG and am converting 42K lines of VBA code to C# right now. The custom task is actually not bad just read about interfaces and how they work. Create a WPF project in Visual Studio (free) and implement the SAS interfaces. From there, create a simple app with as many dropdowns, lists, comboboxes, etc. that you wish. Visual Studio will actually implement the whole interface for you so there is no need to dig around looking for how to do it.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.