Hey @Deep04! STPs and Viya Jobs are very similar, but you'll need to make some changes to download data as an Excel file. I assume you're looking to have this available in Visual Analytics for convenience or as a part of another report.
To write a file to an Excel file that will download to the user's desktop, there are a few things you need to do to your code. The best way to explain this is through an example. Here is code below that will send the results of PROC PRINT to an Excel file that downloads in your browser.
/* Write an Excel file to the job using the filesrvc access method. The job will handle the rest. */
filename excelout filesrvc
parenturi="&SYS_JES_JOB_URI" /* URI of the job that we're currently running */
name='_webout.xlsx' /* You must write to _webout.extension. The filename is controlled in contentdisp. */
contenttype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' /* Content type */
contentdisp='attachment; filename="my_excel_file.xlsx"'; /* This is an attachment called my_excel_file.xlsx */
;
ods html close;
ods tagsets.ExcelXP file=excelout style=htmlblue;
proc print data=sashelp.cars;
run;
Use the following parameters for your job:
It's very similar to what you did with STPs, but a little more streamlined. Mostly everything you need to do is done within a filename statement with the filesrvc access method. Many of the macro variables and things you used to set are no longer needed, but many of the familiar names you used are still there (like _webout).
Now if you want to get really advanced, you can use Data Driven Content and pass things from Visual Analytics into the job. That's a pretty complex topic but if you want to learn how to do this, check out the Advanced Scenario Topics section of my paper Modernizing Scenario Analysis with SAS Viya and SAS Viusal Analytics.
... View more