Exporting sas7bdat using _webout

Accepted Solution Solved
Reply
Contributor
Posts: 20
Accepted Solution

Exporting sas7bdat using _webout

Hello,

 

I am trying to export sas dataset created to my pc using _webout as sas in installed in unix and there is no shared folder between sas server and my pc. Could you suggest me an approach to the requirement ? i have tried proc export but it didnot worked for me...

 

Thank you!!!


Accepted Solutions
Solution
‎12-01-2016 03:46 AM
Esteemed Advisor
Posts: 6,695

Re: Exporting sas7bdat using _webout

You can't write the contents of a .sas7bdat to the _webout destination, as the contents of .sas7bdat files are partially binary. _webout is always supposed to be text.

If you want a .sas7bdat file to go somewhere, create the dataset in that location, or use any file transfer tool (SFTP etc)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Esteemed Advisor
Posts: 6,695

Re: Exporting sas7bdat using _webout

You have to stream your dataset to _webout in a format that can be recognized by the browser, so it can then call a suitable application to open the data.

To set the MIME type for the _webout stream, find information here: http://support.sas.com/kb/23/650.html

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 20

Re: Exporting sas7bdat using _webout

Hello, i have tried following code to export data:

data _null_;
 rc=stpsrv_header('Content-type',"text/html; encoding=WINDOWS-1252");
rc=stpsrv_header('Content-disposition','attachment; filename=TableBackup.sas7bdat');

ods csv body =_webout ;
 proc print data=abc noobs; 
run;
ods csv close; 
run;

i got sas dataset as output, which works perfectly if i go to eg and import data as step, but it shows error when i double click file and try to open in eg.

Please help me for this case.

Esteemed Advisor
Posts: 6,695

Re: Exporting sas7bdat using _webout

Do not use the .sas7bdat extension for csv files; use .csv instead.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 20

Re: Exporting sas7bdat using _webout

Hello,

i don't want csv as output, i want sas7bdat as output. I am using proc csv for compiling result in one file tabular form.should i use any other code in place of proc csv?could you suggest please?i have tried proc sql too but it failed giving desired output.

P.S.:i get error saying the open data operation failed.

Thank you.

Solution
‎12-01-2016 03:46 AM
Esteemed Advisor
Posts: 6,695

Re: Exporting sas7bdat using _webout

You can't write the contents of a .sas7bdat to the _webout destination, as the contents of .sas7bdat files are partially binary. _webout is always supposed to be text.

If you want a .sas7bdat file to go somewhere, create the dataset in that location, or use any file transfer tool (SFTP etc)

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 299 views
  • 1 like
  • 2 in conversation