This is more a collection of pointers than a full solution, but should lead you on the right path.
Step 1 - Loading your zip file to the SAS server
For this you can use a form, or ajax, in your web front end. The form approach is documented here: https://support.sas.com/documentation/cdl/en/stpug/61271/HTML/default/viewer.htm#a003254547.htm
Step 2 - Find and Unzip using SAS and save to folder
The file you uploaded will be stored in a macro variable named
To avoid a subsequent move of the folder, the best approach would be to unzip it directly to the target location. You can do this using a pipe:
infile"unzip %sysfunc(pathname(&_WEBIN_FILEREF1)) -d &target_location" pipe;
Or with a pure sas approach - https://blogs.sas.com/content/sasdummy/2015/05/11/using-filename-zip-to-unzip-and-read-data-files-in....
Hope this helps! SAS is a great platform for building web applications. For further reference materials, check out the following:
There is also a SPWA tag on Sasensei with a number of tips on this topic.
This is a new information for me and it really helps me.
STEP 1: I tried the html but I am getting "Unsupported Media Type", do I need to configure anything in the storedprocess which I created?
I created a stored process via SAS enterprise guide and copy the infile command you created there, but didn't add any prompts, datasouce targets etc.. is this the reason for the error message?
Where do you get the "Unsupported Media Type" message? When you hit "OK" in the web form, or in the SAS log of the stored process?
Please post your HTML code for the form, and the code of the stored process.
i created a sample stored process with out any content, just a %put comment.
The webservice is not triggered at all, if so we need to get any error atleast.
i triggered using REST client/postman and through HTML form.
Both i get unsupported media type.
<form action="StoredProcessWebApplicationURL" method="post" enctype="multipart
/form-data"> <input type="hidden" name="_program" value="/Path/StoredProcessName"> <table border="0" cellpadding="5"> <tr> <th>Choose a file to upload:</th> <td><input type="file" name="myfile"></td> </tr> <tr> <td colspan="2" align="center"><input type="submit" value="OK"></td> </tr> </table> </form>
I created a stored process in SAS enterprise guide, with no logical code inside,
select execution option in storedprocess server and doesn't add any data source targets etc..
through html form and using rest client/postman i uploaded a file with content type multipart/form-data and hit send button in rest client/api and ok button in html form and i am getting unsupported media type.
Does this means sas 9.4 is not suppporting this media type or do i need to change anyting in the stored process or any configuration changes in the sas server?
when i use other content types such as text/xml etc...i am not getting this message atleast i am getting some error.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.