BookmarkSubscribeRSS Feed
sunilreddy
Fluorite | Level 6

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?

1 REPLY 1
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 11654 views
  • 1 like
  • 2 in conversation