BookmarkSubscribeRSS Feed
chris_lampron
Fluorite | Level 6

Good morning forum,

I am currently working on a set of chained stored processes (3 in total) in which the first stored process prompts the user to select a file that will be uploaded.  The stored process is using HTML forms to display the page and create the buttons and browser to select a file.  The form looks like this:

data form;
  format infile $char256.;
  input;
  infile=resolve(_infile_);
  cards;

<HTML>
<BODY bgcolor="#CAD6DA">
<FORM ACTION="&_URL" method="post" enctype="multipart/form-data">
<INPUT TYPE="HIDDEN" NAME="_program" VALUE="Path to Second Stored Process">
<INPUT TYPE="HIDDEN" NAME="submit" VALUE="submitted">
<table border="0" cellpadding="5">
<tr>
<td colspan="2">
<INPUT TYPE="file" NAME="Attach1" />
</td></tr>
<tr>
<td colspan="2">
<INPUT TYPE="submit" value="Upload">
</td></tr>
</table>
</FORM>
</BODY>
</HTML>
;
run;

data _null_;
  file _webout;
  set form;
  put infile;
run;

Once the 'Upload' button is selected, a second stored process is called and the selected file (a .xlsx file) is uploaded and proc sgplot is used to plot the data for visual representation of the uploaded file.

What I would like to happen is have 2 buttons on the second stored process.

  • One will be a 'Go Back' button if the data doesn't look right (maybe the wrong file was uploaded, format of file is incorrect, etc.) and allow the user to either fix the file or upload a different one.
  • The second button would be a 'Continue' button where a third stored process would be called.

The 'Go Back' button works fine to send the user back to the first stored process and allow for them to upload the file again.  The 'Continue' button, bringing the user to the third stored process is where my problem is.

In the third stored process, I would like the same uploaded file from the second stored process to be called and used in data steps.

Right now on the third stored process, I am having some difficulties

  1. If i try to upload the file again, I get the following error:
    ERROR: Unable to import, please specify a DATAFILE.
  2. If I don't try to upload the file and just call the data set, I get the following error:
    ERROR: WORK.XXXX.DATA does not exist.

The import code I am using is:

proc import out=excel
  file="%sysfunc(pathname(&_webin_fileref))"
  dbms=xlsx
  replace;
run;

Does anyone have any suggestions on how to either bring them dataset from the second stored process into the third, or be able to upload the file selected in the first stored process?

Thank you.

--Chris.

1 REPLY 1
Fordmustang5l
Calcite | Level 5

Unless you establish a sessoion, data in the work library is deleted when chaining together different stored processes.

 

Try the technique described here and see if you are able to refernce WORK dataset after clicking continue.

 

http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/sessions.html

http://support.sas.com/rnd/itech/doc9/dev_guide/stprocess/sesssamp.html

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1255 views
  • 0 likes
  • 2 in conversation