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
Quartz | Level 8

 

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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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