Uploading a File (via the Web) into SAS

This post was kindly contributed by real business intelligence for real users - go there to comment and to read the full post.

I must recommend that you check out this example from pg 70 of the SAS Stored Process Developers Guide. http://support.sas.com/documentation/cdl/en/stpug/61271/PDF/default/stpug.pdf

This is a pretty sweet example of how to upload a file from your machine (via Internet Explorer) into the SAS System.

A custom form can be created in html – or within data _null_ steps within a Stored Process. Modify the highlighted value= to the path of the subsequent stored process that you will run.

<form action=”StoredProcessWebApplicationURL” enctype=”multipart/form-data” method=”post”>
</form>
<input type=”hidden” name=”_program” value=”/Path/StoredProcessName“>
<table border=”0″ cellpadding=”5″>
<tbody>
<tr>
<th>Choose a file to upload:</th>
<td><input name=”myfile” type=”file” /></td>
</tr>
<tr>
<td align=”center” colspan=”2″><input type=”submit” /></td>
</tr>
</tbody></table>

Then the stored process (the value that correspond to the path highlighted above “/Path/StoredProcessName“) that runs when the user selects the “submit” button will need to use the hidden parameters available when using the ‘file’ input type. Table 5.5 in the document lists these values, and the example at the bottom of page 71 shows how to simply use a data null infile process to grab the contents of the uploaded file in SAS.

This post was kindly contributed by real business intelligence for real users - go there to comment and to read the full post.