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
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:
filename csvout 'c:\temp\class_exp.csv';
proc export data=sashelp.class
filename csvods 'c:\temp\class_ods.csv';
ods csv file=csvods;
proc print data=sashelp.class noobs;
var name height age sex ;
ods csv close;
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:
proc print data=sashelp.class noobs;
var name age height sex;
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.
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.