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!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1824 views
  • 2 likes
  • 4 in conversation