Hi everyone,
I would like to write a SAS code (to insert in a Stored Process) that, in the same time, downloads a zip file from a server and opens in my browser a new tab printing some messages. So far, I coded this program:
Data _null_; file _webout recfm=s; infile "&filepath./&filename." recfm=n; if _n_ = 1 then do; rc = stpsrv_header('Content-type','application/zip'); rc = stpsrv_header("Content-disposition","attachment; filename=&filename."); put "<label><center><b>My message to print in a new web page</b></center></label>"; end; input c $char1.; put c $char. @@; run;
The macro variables &filepath and &filename contain, respectevely, the path and the name of the zip file that I want to download. The download ends successfully, but I cannot get my new web page with the message. If I run the put statement with the message alone in a data step, it works. On the contrary, if I try to run the put task and the download task in either the same data step (as in the previous code), or in two different data steps, only the download ends successfully.
Can you help me?
Thanks
You could try playing with the headers to do a 302 redirect but I'm not sure if it will work
The "proper" way of handling this would be to have a frontend that:
1. requests the zip download
2. redirects to the desired page
This is how we manage it using Data Controller for SAS.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.