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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.