BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

Is it possible to add VBA codes into sas  when I export table from sas into excel?

 

 

4 REPLIES 4
PeterClemmensen
Tourmaline | Level 20

I'm not sure but I don't think so.

Patrick
Opal | Level 21

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.

ChrisNZ
Tourmaline | Level 20

>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 ?

Patrick
Opal | Level 21

@ChrisNZ 

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".

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1036 views
  • 1 like
  • 4 in conversation