BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
SASdevAnneMarie
Barite | Level 11

 Hello Experts,

 

I'm looking for a way to name the sheet while the proc export on csv file ?

 

Thank you !

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

A CSV file is just a text file. A CSV file does not have "sheet name".  When you are writing a CSV file you only need to specify the name of the FILE you want to create.

View solution in original post

4 REPLIES 4
himself
Pyrite | Level 9

 

Spoiler
 

Hi I think to do this you need to specify the sheet name as follows:  

i.e use the Sheet statement

 

Hope this helps.

 

 

proc export data=mydata 
            outfile='C:\path\to\mydata.csv' 
            dbms=csv 
            replace;
    sheet='MySheetName';/*Insert the Sheet name here*/
run;
JosvanderVelden
SAS Super FREQ
The sheet statement is only valid when using excel-specific dbms (ex. dbms=xlsx). For more information read the documentation https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/acpcref/n0msy4hy1so0ren1acm90iijxn8j.htm#p18z.... If you want to preserve formats also read: https://communities.sas.com/t5/SAS-Procedures/How-to-retain-the-Variable-Format-when-PROC-EXPORT-TO-...
Tom
Super User Tom
Super User

A CSV file is just a text file. A CSV file does not have "sheet name".  When you are writing a CSV file you only need to specify the name of the FILE you want to create.

SASdevAnneMarie
Barite | Level 11
Thank you Tom!

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 4 replies
  • 976 views
  • 2 likes
  • 4 in conversation