I'm importing the data from .xlsx and using proc sql to create/manipulate the data in SAS 9.4.
This is how I'm currently exporting to .xlsx but this overwrites that particular sheet. I want to reuse the same sheet.
proc export
DATA = data_name
DBMS = xlsx
OUTFILE = "C:\\...\outfile.xlsx"
REPLACE;
sheet=sheet_name;
run;
I guess one alternative would be to do all the data manipulation and then do a single export as opposed to data manipulation then export, data manipulation then export, data manipulation then export, and so on. But is there a way to export without overwriting? I tried looking this up and nothing relevant came up.
Thanks
Edit: I want different sets of data on the same sheet one below the other, sort of like appending
Do you want to place to different sets of data on the same sheet one below the other?
Or are you expecting to have this behave as a single block of data just adding lines without a header row?
Export in not the most flexible tool as it is pretty much intended to create one output file for one data set.
You might be able to accomplish what you want with ODS Excel as that will allow multiple procedures to send ODS output, such as Proc Print, to the same or different sheets depending on options like Sheet_interval.
Alright, thanks for the info, I'll take a look into ODS Excel
If you're on Windows then take a look at the exportxl macro. I think it can do everything that you described. You can download it from:
http://www.sascommunity.org/wiki/Excelling_to_Another_Level_with_SAS
Art, CEO, AnalystFinder.com
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.