BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Can anyone tell me how should I convert my dataset to a csv file without using a code.Since it is my part of my process flow that is the output of my process flow i.e dataset i have to save it as csv file.This whole process i have to create a stored process.

I have tried the function in EG i.e. right click on that dataset and export but it is there for that session and when i create a stored process it tells me that we can`t generate code for export task.
So can anyone help me with this
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Sunil:
Almost everything you do in your EG project generates code. So, I'm not sure about the "without code" part of your question -- and whether that's even possible. For example, when you create a LIST data task, EG generates PROC PRINT code behind the scenes. when you create a One-Way Frequency List, EG generates PROC FREQ code behind the scenes.

You should be able to code either a PROC EXPORT or an ODS CSV code block in a code node window in your project to do the export:
[pre]
filename csvout 'c:\temp\class_exp.csv';
proc export data=sashelp.class
outfile= csvout
dbms=dlm replace;
delimiter=',';
run;

filename csvods 'c:\temp\class_ods.csv';
ods csv file=csvods;
proc print data=sashelp.class noobs;
var name height age sex ;
run;
ods csv close;
[/pre]

The difficulty will come in when you go to make your stored process, since the workspace server and stored process server generally do NOT have visibility of the user's C drive when they execute a stored process.

One possible approach is to have your stored process do a PROC PRINT on the dataset and then the end-user could access the file using the SAS Add-in for Microsoft Office -- Excel has the option to return stored process results AS either HTML, SASREPORT or CSV -- so your stored process would do a simple PROC PRINT and if they wanted CSV, then you could give them instructions how to change the choice under
SAS --> Options to return CSV results from the stored process. For example, this stored process:
[pre]
*ProcessBody;
%stpbegin;
proc print data=sashelp.class noobs;
var name age height sex;
run;
%stpend;
[/pre]
could be executed inside Web Report Studio and they would see a listing report in Web Report Studio. On the other hand, if they were working inside Excel AND they had the SAS Add-in for Microsoft Office installed, they could choose to run this stored process and just have the results come back to them as CSV.

Another approach is to return the stored process results as a package and put the CSV file into the package.

If you are using the Stored Process Web Application, another alternative is to write your stored process to return CSV results and send a content-type header that would alert the browser to launch Excel when the stored process results were sent back to the requesting user.

Tech Support can help you figure out the best way to return your results, depending on your particular configuration and how you planned to execute the stored process.

cynthia
deleted_user
Not applicable
can you tell me where can i change the settings for csv file since i cant see any option of CSV file in EG TOOLS--> Options
Cynthia_sas
SAS Super FREQ
Sunil:
Sorry, my bad, I was not clear in my explanation. EG does NOT have the option to return CSV from a toolbar/menu choice. That option only exists within Excel under the SAS Add-in for Microsoft Office -- by clicking
SAS --> Options --> and then looking for either the Results tab or the Stored Process tab to change the result format to CSV(I'm not at a computer with the BI image right now, so I can't check).

EG, of course, returns the MAIN ODS result types -- HTML, RTF, PDF and SASReport XML via a menu choice. But, there is not a Tools--> Options choice to return CSV. To create a CSV file, you would have to use code within a code node. However, if you submitted the code shown in my previous post, from within EG, you would essentially see a "Notepad-type" window with the CSV results.

The point that I was trying to make is that having EG make CSV output as a menu choice just doesn't make a lot of sense, when you can do a direct export of results to Excel with a Right-Mouse click or can run a stored process in Excel whose results can be returned as CSV. (This same logic applies to Microsoft Word -- if you look at the menu choices for result types in Word, you will not find CSV listed -- that's because Word doesn't really -do- anything with a CSV file. There's no menu choice in Excel for returning RTF results, because Excel doesn't know what to do with RTF results.)

So, there's no menu choice in Excel for automatic creation of CSV files. If you need to create a CSV file in a project, then your choices are a PROC EXPORT code step to export a SAS data set to CSV format or have an ODS CSV code step to return procedure results as a CSV file.

I hope this explanation makes my previous post clearer.

cynthia

sas-innovate-2024.png

Today is the last day to save with the early bird rate! Register today for just $695 - $100 off the standard rate.

 

Plus, pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 4064 views
  • 0 likes
  • 2 in conversation