BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Ronein
Onyx | Level 15

Hello

I want to ask a question about export SAS data set into XLSX file.

What is the difference between:

1- save the file in memory ?

2-save the file in work directory

3-save the file in computer path 

 

 

thanks

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

1- save the file in memory ?

You can't export a SAS dataset to an Excel XLSX file in memory. It has to be on disk. Once on disk, use Excel to open the workbook and that loads it into memory. 

2-save the file in work directory

I assume you mean the SAS WORK directory here? Run this to find out where it is:

%put %sysfunc(pathname(WORK));

 3-save the file in computer path

Save the file to a particular folder on disk.

 

View solution in original post

11 REPLIES 11
SASKiwi
PROC Star

1- save the file in memory ?

You can't export a SAS dataset to an Excel XLSX file in memory. It has to be on disk. Once on disk, use Excel to open the workbook and that loads it into memory. 

2-save the file in work directory

I assume you mean the SAS WORK directory here? Run this to find out where it is:

%put %sysfunc(pathname(WORK));

 3-save the file in computer path

Save the file to a particular folder on disk.

 

Ronein
Onyx | Level 15

Thanks,

In previous post it was said that I can export sas data set into XLSX file that will be "saved" in work library.

As I see you said that it cannot be done?

proc export dbms=xlsx data=sashelp.class
file="%sysfunc(pathname(work))/class.xlsx" replace;
run;
PaigeMiller
Diamond | Level 26

You can export a SAS data set as an .xlsx file to ANY folder you have write permission to, including the folder assigned to the WORK library in SAS.

 

So what is your real question?

--
Paige Miller
Ronein
Onyx | Level 15

Thanks,
Should I have special permission in order to export sas data set into XLS file in work library?
How can I know If i have this permission?

I was sure that work library is only for sas data sets and now I understand that I can save there also XLSX files that were created from sas data sets?

Kurt_Bremser
Super User

By definition, you have complete read/write/execute permission on your WORK directory, otherwise it would be of no use. You need these permissions to create datasets there, and retrieve a library listing.

SASKiwi
PROC Star

Saving XLSX files in your SAS work directory is not a good idea as this is deleted at the end of your SAS session.

Tom
Super User Tom
Super User

@SASKiwi wrote:

Saving XLSX files in your SAS work directory is not a good idea as this is deleted at the end of your SAS session.


Depends on what you are trying to do.

 

Saving XLSX files in your SAS work directory IS  a GOOD idea BECAUSE this is deleted at the end of your SAS session.

 

PaigeMiller
Diamond | Level 26

@Tom wrote:

@SASKiwi wrote:

Saving XLSX files in your SAS work directory is not a good idea as this is deleted at the end of your SAS session.


Depends on what you are trying to do.

 

Saving XLSX files in your SAS work directory IS  a GOOD idea BECAUSE this is deleted at the end of your SAS session.

 


I look at it differently. If you want it deleted at the end of your SAS session, why create the Excel file at all? What is the benefit?

--
Paige Miller
Tom
Super User Tom
Super User

The benefit is that something/someone else cleans up after you.

 

https://communities.sas.com/t5/SAS-Programming/save-data-sets-into-XLSX-files-in-sas-screen/m-p/8044...

 

PaigeMiller
Diamond | Level 26

@Ronein wrote:

Thanks,
Should I have special permission in order to export sas data set into XLS file in work library?
How can I know If i have this permission?

I was sure that work library is only for sas data sets and now I understand that I can save there also XLSX files that were created from sas data sets?


The WORK library is in a folder somewhere. It has not other special meaning other than it is a folder. You can write any files you want to that folder (if you have write permission to that folder). Your operating system doesn't care. SAS doesn't care. People like those of us trying to respond to your question do care ... why would you want to do this? What is your real question?

--
Paige Miller
PaigeMiller
Diamond | Level 26

@Ronein wrote:

 

I want to ask a question about export SAS data set into XLSX file.

What is the difference between:

1- save the file in memory ?

2-save the file in work directory

3-save the file in computer path 


1- no such thing

2 vs 3 ... different folder on one of your hard disks or network disks

--
Paige Miller

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 11 replies
  • 2583 views
  • 4 likes
  • 5 in conversation