The SAS Output Delivery System and reporting techniques

multiple sheets in csv excel

Reply
Frequent Contributor
Posts: 115

multiple sheets in csv excel

I'm using below Proc export code to export CSV excel file into path and able to create second dataset(recs&i), But i am not able to create multiple sheets(header, recs&i) in same excel

I've tried to use statement SHEET option in both procs, but getting error.

/*create files on local server*/

PROC EXPORT DATA= header

       LABEL

                 OUTFILE= "&full_path_outfile."

                 DBMS=CSV REPLACE;

               

     RUN;

PROC EXPORT DATA= recs&i.

       LABEL

                 OUTFILE= "&full_path_outfile."

                 DBMS=CSV REPLACE; DELIMITER=';';

               

     RUN;

As i am creating CSV file with ; delimiter, and able to open CSV file directly into excel, Could you please suggest the way to create multiple sheets in same csv excel file?

Super User
Super User
Posts: 7,942

Re: multiple sheets in csv excel

Posted in reply to sunilreddy

CSV file format does not have the concept of "Sheets".  It is a flat text format file.  Excel has the concept of "Sheet".  If you want to view the data in separate sheets in Excel then you need to change your export target to be Excel not CSV.  However I recommend if you are exporting to Excel to use the newer ExceXP tagset to output your data as you have far more control and options: Base SAS: Demo: ExcelXP Tagset and Microsoft Excel

Ask a Question
Discussion stats
  • 1 reply
  • 6043 views
  • 1 like
  • 2 in conversation