<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic create page html for upload file from visual analytics in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/create-page-html-for-upload-file-from-visual-analytics/m-p/780370#M15622</link>
    <description>&lt;P&gt;Hello to all, my client asks to create a page that can be called up from visual analytics to give the user the possibility to upload excel sheets. At the moment I have created a small job that allows you to select the file:&lt;/P&gt;
&lt;P&gt;code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;file _webout;&lt;BR /&gt;put "&amp;lt;html&amp;gt;";&lt;BR /&gt;put "&amp;lt;body&amp;gt;";&lt;BR /&gt;put'&amp;lt;form method="post" enctype="multipart/form-data"&amp;gt;';&lt;BR /&gt;put"&amp;lt;div&amp;gt;";&lt;BR /&gt;put '&amp;lt;label for="file"&amp;gt;Choose file to upload&amp;lt;/label&amp;gt;';&lt;BR /&gt;put'&amp;lt;input type="file" id="file" name="file" multiple&amp;gt;';&lt;BR /&gt;put"&amp;lt;/div&amp;gt;";&lt;BR /&gt;put" &amp;lt;div&amp;gt;";&lt;BR /&gt;put"&amp;lt;button&amp;gt;Submit&amp;lt;/button&amp;gt;";&lt;BR /&gt;put" &amp;lt;/div&amp;gt;";&lt;BR /&gt;put"&amp;lt;/form&amp;gt;";&lt;BR /&gt;put"&amp;lt;/body&amp;gt;";&lt;BR /&gt;put "&amp;lt;/html&amp;gt;";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the problem I have is that I don't know how to save the file in a path of my server to be able to process it with SAS. Can anyone give me directions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 16 Nov 2021 09:11:22 GMT</pubDate>
    <dc:creator>dipand</dc:creator>
    <dc:date>2021-11-16T09:11:22Z</dc:date>
    <item>
      <title>create page html for upload file from visual analytics</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/create-page-html-for-upload-file-from-visual-analytics/m-p/780370#M15622</link>
      <description>&lt;P&gt;Hello to all, my client asks to create a page that can be called up from visual analytics to give the user the possibility to upload excel sheets. At the moment I have created a small job that allows you to select the file:&lt;/P&gt;
&lt;P&gt;code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data _null_;&lt;BR /&gt;file _webout;&lt;BR /&gt;put "&amp;lt;html&amp;gt;";&lt;BR /&gt;put "&amp;lt;body&amp;gt;";&lt;BR /&gt;put'&amp;lt;form method="post" enctype="multipart/form-data"&amp;gt;';&lt;BR /&gt;put"&amp;lt;div&amp;gt;";&lt;BR /&gt;put '&amp;lt;label for="file"&amp;gt;Choose file to upload&amp;lt;/label&amp;gt;';&lt;BR /&gt;put'&amp;lt;input type="file" id="file" name="file" multiple&amp;gt;';&lt;BR /&gt;put"&amp;lt;/div&amp;gt;";&lt;BR /&gt;put" &amp;lt;div&amp;gt;";&lt;BR /&gt;put"&amp;lt;button&amp;gt;Submit&amp;lt;/button&amp;gt;";&lt;BR /&gt;put" &amp;lt;/div&amp;gt;";&lt;BR /&gt;put"&amp;lt;/form&amp;gt;";&lt;BR /&gt;put"&amp;lt;/body&amp;gt;";&lt;BR /&gt;put "&amp;lt;/html&amp;gt;";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the problem I have is that I don't know how to save the file in a path of my server to be able to process it with SAS. Can anyone give me directions?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 09:11:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/create-page-html-for-upload-file-from-visual-analytics/m-p/780370#M15622</guid>
      <dc:creator>dipand</dc:creator>
      <dc:date>2021-11-16T09:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: create page html for upload file from visual analytics</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/create-page-html-for-upload-file-from-visual-analytics/m-p/780451#M15623</link>
      <description>&lt;P&gt;When files are uploaded to SAS through either a Viya Job or STP, they are saved to a temporary storage location. You can access it using the macro variable&amp;nbsp;&lt;SPAN&gt;_WEBIN_FILEREF. Since they can upload multiple files, multiple macro variables will be available, and the number of files uploaded is stored in _WEBIN_FILE_COUNT. For example, if they are uploading two files:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;_WEBIN_FILE_COUNT = 2
_WEBIN_FILEREF1   = #LN0001
_WEBIN_FILEREF2   =&amp;nbsp;#LN0002&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;However, if _WEBIN_FILE_COUNT = 1, you will only use _WEBIN_FILEREF:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;_WEBIN_FILE_COUNT = 1
_WEBIN_FILEREF    = #LN0001&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN&gt;If you want to only process these files, count the number of files using _WEBIN_FILE_COUNT, then run your import code just like any other SAS code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;/* Test values */
%let _WEBIN_FILE_COUNT = 1;
%let _WEBIN_FILEREF    = a;
%let _WEBIN_FILEREF1   = b;
%let _WEBIN_FILEREF2   = c;

/* copy:   Optional. if YES, copies the file to "outdir" 
   outdir: Location to copy the uploaded file permanently 
*/
%macro read_uploaded_files(copy=NO, outdir=/directory/here);
    %local i n;
    %let outdir = %superq(outdir);
    %let copy   = %upcase(&amp;amp;copy);

    %put Total files: &amp;amp;_WEBIN_FILE_COUNT;

    /* Read in all the uploaded files and output sequentially to datasets &lt;BR /&gt;       named excelout1, excelout2, etc.&lt;BR /&gt;    */
    %do i = 1 %to &amp;amp;_WEBIN_FILE_COUNT;

        /* Add a suffix if more than one file was uploaded */
        %if(&amp;amp;_WEBIN_FILE_COUNT &amp;gt; 1) %then %let n = &amp;amp;i;

        %put Importing fileref %nrbquote(&amp;amp;)_WEBIN_FILEREF&amp;amp;n.: &amp;amp;&amp;amp;_WEBIN_FILEREF&amp;amp;n.;

        /* Read the file in to SAS. Comment out for testing. */
        proc import 
            file = &amp;amp;&amp;amp;_WEBIN_FILEREF&amp;amp;n.
            out  = excelout&amp;amp;i.
            dbms = xlsx
            replace;
        run;
    
        /* Copy the file somewhere to the server permanently */
        %if(&amp;amp;copy. = YES) %then %do;
            filename outfile "&amp;amp;outdir./&amp;amp;&amp;amp;_WEBIN_FILENAME&amp;amp;n";
            %let rc = %sysfunc(fcopy(&amp;amp;&amp;amp;_WEBIN_FILEREF&amp;amp;n., outfile) );
        %end;

    %end;
%mend;
%read_uploaded_files;
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Nov 2021 16:30:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/create-page-html-for-upload-file-from-visual-analytics/m-p/780451#M15623</guid>
      <dc:creator>Stu_SAS</dc:creator>
      <dc:date>2021-11-16T16:30:11Z</dc:date>
    </item>
  </channel>
</rss>

