<?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 Re: SAS Loop over dataset for create export files in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/591074#M169266</link>
    <description>&lt;P&gt;i tried and got below error. do i need to modify the code with some syntax issue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saserr.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32697i62D902B1D6C78E25/image-size/large?v=v2&amp;amp;px=999" role="button" title="saserr.JPG" alt="saserr.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Sep 2019 04:26:04 GMT</pubDate>
    <dc:creator>VimalManavalan</dc:creator>
    <dc:date>2019-09-24T04:26:04Z</dc:date>
    <item>
      <title>SAS Loop over dataset for create export files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/539249#M148552</link>
      <description>&lt;P&gt;Good morning all,&lt;/P&gt;&lt;P&gt;i have a SAS Work table and i'm trying to loop this one in order to launch 1 proc export for every row in this work file:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File UTENTI:&lt;/P&gt;&lt;P&gt;utente&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;email&lt;/P&gt;&lt;P&gt;user1&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; user1@example.com&lt;/P&gt;&lt;P&gt;user2&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; user2@example.com&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried this code, but it doesn't work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/* getting numbers of occurencies*/&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select count(*) into :nb from WORK.UTENTI;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;/* set eof record number */&lt;BR /&gt;%let nb = &amp;amp;nb;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data t;&lt;BR /&gt;set WORK.UTENTI;&lt;BR /&gt;do i=1 to &amp;amp;nb;&lt;BR /&gt;put "DBUSER=&amp;amp;utente";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;create table EXPORTEXCEL as&lt;BR /&gt;select * from WORK.FILTER_FOR_QUERY_FOR_RE2PRABA_00&lt;BR /&gt;where FILIALE IN(SELECT filiale FROM WORK.UTENTI_FILIALI WHERE FILIALE=filiale and utente = &amp;amp;DBUSER);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc export&lt;BR /&gt;data=WORK.EXPORTEXCEL&lt;BR /&gt;outfile="C:\SasOutputs\Mail\RSK_001_Pratiche_A_Rischio_&amp;amp;DBUSER.xlsx"&lt;BR /&gt;replace&lt;BR /&gt;dbms=xlsx;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example, i need to loop 2 times selecting data for user1 and user2. I want to make this procedure dynamics no matter what the occurencies will be.&lt;/P&gt;&lt;P&gt;Someone can give me an advice?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Gianluca&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 10:25:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/539249#M148552</guid>
      <dc:creator>Gciocia</dc:creator>
      <dc:date>2019-02-28T10:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Loop over dataset for create export files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/539250#M148553</link>
      <description>&lt;P&gt;No need for a loop here, a dataset is a loop:&lt;/P&gt;
&lt;PRE&gt;data _null_;
  set work.utenti;
  call execute(cats('proc export data=',utente,' outfile="c:\sasoutputs\mail\rsk_001_practiche_a_reichio_',email,'xls"; run;'));
run;&lt;/PRE&gt;
&lt;P&gt;That will generate a proc export step for every row in the dataset.&amp;nbsp; From that you can work out your specifics, but it avoids all the find number of obs, do loop etc.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 10:34:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/539250#M148553</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-02-28T10:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Loop over dataset for create export files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/540369#M149048</link>
      <description>&lt;P&gt;Thanks a lot RW9, it worked!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2019 08:48:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/540369#M149048</guid>
      <dc:creator>Gciocia</dc:creator>
      <dc:date>2019-03-05T08:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Loop over dataset for create export files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/591074#M169266</link>
      <description>&lt;P&gt;i tried and got below error. do i need to modify the code with some syntax issue&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="saserr.JPG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/32697i62D902B1D6C78E25/image-size/large?v=v2&amp;amp;px=999" role="button" title="saserr.JPG" alt="saserr.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 04:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/591074#M169266</guid>
      <dc:creator>VimalManavalan</dc:creator>
      <dc:date>2019-09-24T04:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Loop over dataset for create export files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/591075#M169267</link>
      <description>&lt;P&gt;can this technique be possible to apply this question .&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/New-SAS-User/program-to-export-excel-automatically/m-p/591063#M15146" target="_blank"&gt;https://communities.sas.com/t5/New-SAS-User/program-to-export-excel-automatically/m-p/591063#M15146&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Sep 2019 04:27:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/591075#M169267</guid>
      <dc:creator>VimalManavalan</dc:creator>
      <dc:date>2019-09-24T04:27:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Loop over dataset for create export files</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/592575#M169923</link>
      <description>&lt;P&gt;Please avoid re-opening old questions.&amp;nbsp; I will post update in your other post.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 07:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Loop-over-dataset-for-create-export-files/m-p/592575#M169923</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2019-09-30T07:58:53Z</dc:date>
    </item>
  </channel>
</rss>

