<?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 How to create multiple excel file links in Job Execution in SAS Viya</title>
    <link>https://communities.sas.com/t5/SAS-Viya/How-to-create-multiple-excel-file-links-in-Job-Execution/m-p/869413#M1761</link>
    <description>&lt;P&gt;I have following SAS code that creates two excel links using SAS VIYA JOB EXECUTION.&lt;/P&gt;
&lt;P&gt;However, each excel link outputs the same (last) record of the dataset 'all'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need help/suggestions to fix this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data all;&lt;BR /&gt;format inspectiondate date9.;&lt;BR /&gt;name='Johny'; Month_Year='01-2021'; Rpt_Dt='Inspection_Tasks_2021_01'; InspectionDate='01JAN2021'd;&lt;BR /&gt;output;&lt;BR /&gt;name='Jacob'; Month_Year='02-2021'; Rpt_Dt='Inspection_Tasks_2021_02'; InspectionDate='01FEB2021'd;&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%global actlist Insp_Rpts ; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Proc SQL ;&lt;BR /&gt;Select distinct Month_year into: actlist separated by '~' from all ;&lt;BR /&gt;Select distinct Rpt_Dt into: Insp_Rpts separated by '~' from all ;&lt;BR /&gt;quit; &lt;BR /&gt;&lt;BR /&gt;%put actlist = &amp;amp;actlist. ;&lt;BR /&gt;%put Insp_Rpts = &amp;amp;Insp_Rpts. ; &lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%MACRO RW;&lt;/P&gt;
&lt;P&gt;Proc SQL ;&lt;BR /&gt;Select distinct Month_year into: actlist separated by '~' from all ;&lt;BR /&gt;Select distinct Rpt_Dt into: Insp_Rpts separated by '~' from all ;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;%global actlist Insp_Rpts ;&lt;BR /&gt;&lt;BR /&gt;%put actlist = &amp;amp;actlist. ;&lt;BR /&gt;%put Insp_Rpts = &amp;amp;Insp_Rpts. ; &lt;BR /&gt;&lt;BR /&gt;%let i=1; &lt;BR /&gt;%do %while(%length(%scan(&amp;amp;Insp_Rpts,&amp;amp;i,"~")));&lt;BR /&gt;%let act=%scan(&amp;amp;Insp_Rpts,&amp;amp;i,"~");&lt;/P&gt;
&lt;P&gt;Proc SQL NoPrint; Select min(InspectionDate) FORMAT=MMDDYY10. into:MIN_DATE SEPARATED by ' ' from all&lt;BR /&gt;where Rpt_Dt ="&amp;amp;act."; Quit; %put Min_DATE = &amp;amp;Min_DATE. ; &lt;BR /&gt;Proc SQL NoPrint; Select max(InspectionDate) FORMAT=MMDDYY10. into:MAX_DATE SEPARATED by ' ' from all &lt;BR /&gt;where Rpt_Dt ="&amp;amp;act."; Quit; %put Max_DATE = &amp;amp;Max_DATE. ;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Proc SQL NoPrint; &lt;BR /&gt;Select Min(inspectionDate) format=mmddyy10. into:Stdt SEPARATED by ' ' From work.all where Rpt_Dt ="&amp;amp;act.";; &lt;BR /&gt;Quit; &lt;BR /&gt;&lt;BR /&gt;Proc SQL NoPrint; &lt;BR /&gt;Select Max(inspectionDate) format=mmddyy10. into:Enddt SEPARATED by ' ' From work.all where Rpt_Dt ="&amp;amp;act.";; &lt;BR /&gt;Quit;&lt;BR /&gt;&lt;BR /&gt;%Put Stdt = &amp;amp;Stdt. EndDt = &amp;amp;Enddt. ; &lt;BR /&gt;&lt;BR /&gt;%let i=%eval(&amp;amp;i+1);&lt;BR /&gt;&lt;BR /&gt;ods escapechar='~';&lt;BR /&gt;ods _all_ close;&lt;/P&gt;
&lt;P&gt;%put act_A = &amp;amp;act.; /* *************** */&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;filename f_xlxp filesrvc parenturi="&amp;amp;SYS_JES_JOB_URI" &lt;BR /&gt;name="NR.xml" &lt;BR /&gt;contenttype='application/vnd.ms-excel'&lt;BR /&gt;contentdisp='attachment; filename="&amp;amp;act.xlsx" ' ; &lt;BR /&gt;ods excel file=f_xlxp style=Plateau ; &lt;BR /&gt;&lt;BR /&gt;%LET Curr_date = %left(%qsysfunc(date(),mmddyy10.)) ; &lt;BR /&gt;%let bold_style=~S={font_size=15pt font_weight=bold foreground=blue}~;&lt;BR /&gt;&lt;BR /&gt;title1 j=left color=blue height=14pt "Sample Report "; &lt;BR /&gt;&lt;BR /&gt;Proc print data=all(where=(Rpt_Dt ="&amp;amp;act.")) noobs label sumlabel style(header)={background=#33adff color=white just=center } ;&lt;BR /&gt;&lt;BR /&gt;Title color=blue "&amp;amp;act";&lt;BR /&gt;run; &lt;BR /&gt;&lt;BR /&gt;ods excel close;&lt;BR /&gt;ods _all_ close;&lt;BR /&gt;ods listing;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;file _webout;&lt;BR /&gt;put '&amp;lt;HTML&amp;gt;';&lt;BR /&gt;put "&amp;lt;HEAD&amp;gt;&amp;lt;TITLE&amp;gt;Sample Report&amp;lt;/TITLE&amp;gt;&amp;lt;/HEAD&amp;gt;";&lt;BR /&gt;put '&amp;lt;BODY&amp;gt;';&lt;BR /&gt;put "&amp;lt;P&amp;gt; &amp;lt;font size= 4.5 bgcolor= Black color = Red &amp;gt;Sample Report can be downloaded by clicking on the link below.";&lt;BR /&gt;put "&amp;lt;P&amp;gt;&amp;lt;font size= 4.5 bgcolor= Black color = Red &amp;gt; &amp;lt;a href=""&amp;amp;_FILESRVC_F_XLXP_URI/content"" target=""_SASDLResults""&amp;gt;Click here to download the report&amp;lt;/a&amp;gt;";&lt;BR /&gt;put '&amp;lt;/BODY&amp;gt;';&lt;BR /&gt;put '&amp;lt;/HTML&amp;gt;';&lt;BR /&gt;Run;&lt;BR /&gt;%end; &lt;BR /&gt;%mend;&lt;BR /&gt;%RW;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Apr 2023 14:23:36 GMT</pubDate>
    <dc:creator>GPatel</dc:creator>
    <dc:date>2023-04-12T14:23:36Z</dc:date>
    <item>
      <title>How to create multiple excel file links in Job Execution</title>
      <link>https://communities.sas.com/t5/SAS-Viya/How-to-create-multiple-excel-file-links-in-Job-Execution/m-p/869413#M1761</link>
      <description>&lt;P&gt;I have following SAS code that creates two excel links using SAS VIYA JOB EXECUTION.&lt;/P&gt;
&lt;P&gt;However, each excel link outputs the same (last) record of the dataset 'all'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Need help/suggestions to fix this issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data all;&lt;BR /&gt;format inspectiondate date9.;&lt;BR /&gt;name='Johny'; Month_Year='01-2021'; Rpt_Dt='Inspection_Tasks_2021_01'; InspectionDate='01JAN2021'd;&lt;BR /&gt;output;&lt;BR /&gt;name='Jacob'; Month_Year='02-2021'; Rpt_Dt='Inspection_Tasks_2021_02'; InspectionDate='01FEB2021'd;&lt;BR /&gt;output;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%global actlist Insp_Rpts ; &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Proc SQL ;&lt;BR /&gt;Select distinct Month_year into: actlist separated by '~' from all ;&lt;BR /&gt;Select distinct Rpt_Dt into: Insp_Rpts separated by '~' from all ;&lt;BR /&gt;quit; &lt;BR /&gt;&lt;BR /&gt;%put actlist = &amp;amp;actlist. ;&lt;BR /&gt;%put Insp_Rpts = &amp;amp;Insp_Rpts. ; &lt;BR /&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%MACRO RW;&lt;/P&gt;
&lt;P&gt;Proc SQL ;&lt;BR /&gt;Select distinct Month_year into: actlist separated by '~' from all ;&lt;BR /&gt;Select distinct Rpt_Dt into: Insp_Rpts separated by '~' from all ;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;%global actlist Insp_Rpts ;&lt;BR /&gt;&lt;BR /&gt;%put actlist = &amp;amp;actlist. ;&lt;BR /&gt;%put Insp_Rpts = &amp;amp;Insp_Rpts. ; &lt;BR /&gt;&lt;BR /&gt;%let i=1; &lt;BR /&gt;%do %while(%length(%scan(&amp;amp;Insp_Rpts,&amp;amp;i,"~")));&lt;BR /&gt;%let act=%scan(&amp;amp;Insp_Rpts,&amp;amp;i,"~");&lt;/P&gt;
&lt;P&gt;Proc SQL NoPrint; Select min(InspectionDate) FORMAT=MMDDYY10. into:MIN_DATE SEPARATED by ' ' from all&lt;BR /&gt;where Rpt_Dt ="&amp;amp;act."; Quit; %put Min_DATE = &amp;amp;Min_DATE. ; &lt;BR /&gt;Proc SQL NoPrint; Select max(InspectionDate) FORMAT=MMDDYY10. into:MAX_DATE SEPARATED by ' ' from all &lt;BR /&gt;where Rpt_Dt ="&amp;amp;act."; Quit; %put Max_DATE = &amp;amp;Max_DATE. ;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;Proc SQL NoPrint; &lt;BR /&gt;Select Min(inspectionDate) format=mmddyy10. into:Stdt SEPARATED by ' ' From work.all where Rpt_Dt ="&amp;amp;act.";; &lt;BR /&gt;Quit; &lt;BR /&gt;&lt;BR /&gt;Proc SQL NoPrint; &lt;BR /&gt;Select Max(inspectionDate) format=mmddyy10. into:Enddt SEPARATED by ' ' From work.all where Rpt_Dt ="&amp;amp;act.";; &lt;BR /&gt;Quit;&lt;BR /&gt;&lt;BR /&gt;%Put Stdt = &amp;amp;Stdt. EndDt = &amp;amp;Enddt. ; &lt;BR /&gt;&lt;BR /&gt;%let i=%eval(&amp;amp;i+1);&lt;BR /&gt;&lt;BR /&gt;ods escapechar='~';&lt;BR /&gt;ods _all_ close;&lt;/P&gt;
&lt;P&gt;%put act_A = &amp;amp;act.; /* *************** */&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;filename f_xlxp filesrvc parenturi="&amp;amp;SYS_JES_JOB_URI" &lt;BR /&gt;name="NR.xml" &lt;BR /&gt;contenttype='application/vnd.ms-excel'&lt;BR /&gt;contentdisp='attachment; filename="&amp;amp;act.xlsx" ' ; &lt;BR /&gt;ods excel file=f_xlxp style=Plateau ; &lt;BR /&gt;&lt;BR /&gt;%LET Curr_date = %left(%qsysfunc(date(),mmddyy10.)) ; &lt;BR /&gt;%let bold_style=~S={font_size=15pt font_weight=bold foreground=blue}~;&lt;BR /&gt;&lt;BR /&gt;title1 j=left color=blue height=14pt "Sample Report "; &lt;BR /&gt;&lt;BR /&gt;Proc print data=all(where=(Rpt_Dt ="&amp;amp;act.")) noobs label sumlabel style(header)={background=#33adff color=white just=center } ;&lt;BR /&gt;&lt;BR /&gt;Title color=blue "&amp;amp;act";&lt;BR /&gt;run; &lt;BR /&gt;&lt;BR /&gt;ods excel close;&lt;BR /&gt;ods _all_ close;&lt;BR /&gt;ods listing;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;data _null_;&lt;BR /&gt;file _webout;&lt;BR /&gt;put '&amp;lt;HTML&amp;gt;';&lt;BR /&gt;put "&amp;lt;HEAD&amp;gt;&amp;lt;TITLE&amp;gt;Sample Report&amp;lt;/TITLE&amp;gt;&amp;lt;/HEAD&amp;gt;";&lt;BR /&gt;put '&amp;lt;BODY&amp;gt;';&lt;BR /&gt;put "&amp;lt;P&amp;gt; &amp;lt;font size= 4.5 bgcolor= Black color = Red &amp;gt;Sample Report can be downloaded by clicking on the link below.";&lt;BR /&gt;put "&amp;lt;P&amp;gt;&amp;lt;font size= 4.5 bgcolor= Black color = Red &amp;gt; &amp;lt;a href=""&amp;amp;_FILESRVC_F_XLXP_URI/content"" target=""_SASDLResults""&amp;gt;Click here to download the report&amp;lt;/a&amp;gt;";&lt;BR /&gt;put '&amp;lt;/BODY&amp;gt;';&lt;BR /&gt;put '&amp;lt;/HTML&amp;gt;';&lt;BR /&gt;Run;&lt;BR /&gt;%end; &lt;BR /&gt;%mend;&lt;BR /&gt;%RW;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Apr 2023 14:23:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Viya/How-to-create-multiple-excel-file-links-in-Job-Execution/m-p/869413#M1761</guid>
      <dc:creator>GPatel</dc:creator>
      <dc:date>2023-04-12T14:23:36Z</dc:date>
    </item>
  </channel>
</rss>

