BookmarkSubscribeRSS Feed
As of right now, you have to right click on the dataset on the left pane to export it. After that you have to navigate to the file to download.

It would be nice as a simple button when you get an output of a dataset.
8 Comments
Reeza
Super User

That's one way. You can also use code or a task to add at the end to export your data.

RobP
Quartz | Level 8

@Reeza That is true but it's still far more steps then just right-clicking on a table and choosing 'Download as .csv'.

 

I just came here to enter this exact request as it's a very common workflow coming from using SAS on a PC/workstation to dump results to excel to quickly add calculations/pivot/graph etc... This would probably be the biggest QOL improvement I can think of for SAS Studio right now.

Reeza
Super User

@RobP So the step you have an issue with, is to pick where to save the file? Since it is a right click to download, or is it the part about finding the file to export as well?  Personally, this may be useful, but it's a pretty small need IMO. PROC EXPORT is trivial to learn and is cleaner as is the current process since it forces you to pick a decent location to save data. 

RobP
Quartz | Level 8

@Reeza I don't want to save the data at all on the remote server if I can avoid it.  I'm happy for the CSV to be generated on the fly in some location I don't care about, downloaded, and deleted automatically by SAS immediately after.

 

Base SAS has the feature to right click on a dataset and choose 'View In Excel'.  Myself and the people I work with use this feature dozens of times a day.  It's incredibly convenient.  Although simple, adding a PROC EXPORT step, running it, navigating to that location, and downloading that file is a big step backwards in terms of user experience.

 

I want SAS Studio to be a great user experience.  Quality of life requests like this will help it get there.

 

EDIT:  I should add that as more and more people migrate from PC environments to server environments, features like this will be expected by greater numbers of users.  I've been using this feature in SAS ever since it was added in 9.2?? - not sure when it was added but it was a loonng time ago.  People are used to using base SAS and will want a familiar experience when transitioning to Studio.

angie16
Obsidian | Level 7

I agree completely with @RobP.  I am doing so many adhoc short activities.  I don't need all the additional files the export and download files I would end up with just to get a copy of a dataset when copy and paste or send to excel would be so much easier.

Audron
Obsidian | Level 7

I'm glad that I'm not the only one missing this feature in SAS Studio.

Tom
Super User
Super User

Thanks for explaining the specific key stroke you are trying to mimic.  If you check the settings in your PC-SAS session you will see that menu item is linked to this AF command.   AFA C=SASHELP.EXPLORER.EXCEL_TABLE_OPEN.SCL LIBRARY='%8b' TABLE='%32b';

And if you use it and check what SAS code it submits you get something like:

211 filename _temp_ "C:\Users\...\#LN00058.xls";
212 ods noresults;
213 ods listing close;
214 ods html file=_temp_ rs=none style=minimal;
NOTE: Writing HTML Body file: _TEMP_
215 proc print data=Work.'Want'N label noobs;
216 run;

NOTE: PROCEDURE PRINT used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds


217 ods html close;
218 ods results;
219 ods html;
NOTE: Writing HTML Body file: sashtml1.htm
220 filename _temp_;
NOTE: Fileref _TEMP_ has been deassigned.
221 dm "winexecfile ""C:\...\#LN00058.xls"" ";

So you can see it is quite a kluge (at least in SAS 9.4m5)  It is using ODS HTML to write a file and trying to trick the operating system into opening the file with Excel by naming the file with a .XLS extension.  And reproducing that step one is going to be hard, since SAS/Studio cannot push a call to your PC to run a program.

On PC SAS all you would need to no now-a-days is just run this code:

ods excel file="%sysfunc(pathname(work))/class.xlsx";
proc print data=sashelp.class; run;
ods excel close;

On SAS/Studio you can add some tricks to have SAS/Studio download the results:

%if 0<%sysfunc(fileref(_dataout)) %then %do;
  filename _dataout temp;
%end;
ods excel file=_dataout options (sheet_name="CLASS");
proc print data=sashelp.class;
run;
ods excel close;
%let _dataout_name=class.xlsx;
%let _dataout_mime_type=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet ;

You could create a TASK or perhaps a SNIPPET to generate that code.  But I don't think there is anyway to activate it from just looking at the list of member names like you can do in the Explorer tool in Display Manager. Instead the TASK could allow the user to browse and select the dataset to export.

Reeza
Super User

Several years later, I see the need for a button for this. In addition to the library the Results/OutputDatasets View should have a button that copies data to clipboard if it's under a certain size.