Hello
Is it possible to add VBA codes into sas when I export table from sas into excel?
I'm not sure but I don't think so.
If you want to end up with an Excel workbook that contains both your data from a SAS table and VBA code then easiest would be to already have this Excel workbook created with all the VBA code in it and just have SAS add a data sheet to it.
I believe if you really also would want to generate the VBA code in SAS and fully create the Excel then you would need to write all the code which fully generates the XML for the Excel. I've done that once and can't recommend to try it - it's complicated, fully manually coded and very messy.
>you would need to write all the code which fully generates the XML for the Excel. I've done that once and can't recommend to try it - it's complicated, fully manually coded and very messy.
Maybe a middle-ground-solution would be to have the XML ready and just update the XLSX zip file ?
That's what I've basically done once - and hopefully never will have to do again. Problem is that the MS Office Excel XML is just "ugly".
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.