<?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: ¿Como Crear un Loop  para ejecutar un codigo  N# de Veces? in Forum en español</title>
    <link>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/808299#M749</link>
    <description>&lt;P&gt;None of this requires a loop or a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Extract from each database all 70000 desired records into a data set. Using PROC SQL, join the two data base extracts and the data in VFAC_TR.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Apr 2022 13:26:41 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-04-18T13:26:41Z</dc:date>
    <item>
      <title>¿Como Crear un Loop  para ejecutar un codigo  N# de Veces?</title>
      <link>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/807636#M746</link>
      <description>&lt;P&gt;Hola ,Estoy en busca de como&amp;nbsp; realizar una consulta de una tabla con base en una macro&amp;nbsp; que proviene de otra tabla , esto Ya lo he logrado , sin embargo&amp;nbsp; quiero que esta se repita N# de Veces&amp;nbsp; Teniendo encuenta&amp;nbsp; que al termino de una consulta&amp;nbsp; se sume N =N+1&amp;nbsp; y vuelva a comenzar una parte del programa&amp;nbsp; desde que comienza el Do hasta End&amp;nbsp; &amp;nbsp; &amp;nbsp;Gracias&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;Data;
%LET N=0;
%LET O=1;
%LET N=%eval(&amp;amp;N+&amp;amp;O);


do while(&amp;amp;n &amp;lt; 5);

PROC SQL;
SELECT
    PUT(CTA_CVE,19.) INTO:CLIENTE 
From WORK.CTA_MES_L Where ROW_NUM =&amp;amp;N
;QUIT;
%PUT &amp;amp;CLIENTE;


PROC SQL;
SELECT
    (CTA_FCH_PRM_CMP) INTO:FCH_PRM_CMP
From WORK.CTA_MES_L Where ROW_NUM =&amp;amp;N
;QUIT;
%PUT &amp;amp;FCH_PRM_CMP;


PROC SQL;
Create table TXN as
Select 
FCH   Format   DATE9.   Length   8,
INF   Format   6.   Length   8,
CVE   Format   19.   Length   8,
TRN_CVE   Format   6.   Length   8,
PLAN_CVE   Format   11.   Length   8,
TRN_IMP   Format   20.2   Length   8
From  TABLE.VFAC_TR
where FCH_FCH = "&amp;amp;FCH_PRM_CMP"D
And CTA_CVE=&amp;amp;CLIENTE;
QUIT;


PROC SQL; /* */
INSERT INTO NFCONTRO.ACUM    
SELECT * FROM TXN ;
RUN;

%end;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 16:37:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/807636#M746</guid>
      <dc:creator>EduardoQuiroz</dc:creator>
      <dc:date>2022-04-13T16:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: ¿Como Crear un Loop  para ejecutar un codigo  N# de Veces?</title>
      <link>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/807660#M747</link>
      <description>&lt;P&gt;Please explain (in words, not in SAS code) what this sequence of SQL with macro variables is trying to do. It seems as if you are extracting one row from a data set in one SQL to get a date value, then extracting the same row from another data set in the next SQL to get a client, and then doing a third operation where you extract data from another data set by date and client.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;None of this requires a macro, none of this requires a loop, if I am understanding your code, however I am guessing. Please take the time to explain what it is doing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2022 19:26:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/807660#M747</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-13T19:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: ¿Como Crear un Loop  para ejecutar un codigo  N# de Veces?</title>
      <link>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/808298#M748</link>
      <description>Hello What I am trying to do is extract from a database that I have my rows numbered from 1 to 70000 I want to extract the client's account and the date of the same account where my row number is number 1, I have already achieved this with my macro , however in the next step I use the information stored in the macro and I am going to look for information with these characteristics in another table , so far my code works having found that N = 1&lt;BR /&gt;%LETN=0;&lt;BR /&gt;%LET O=1;&lt;BR /&gt;%LET N=%eval(&amp;amp;N+&amp;amp;O);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now, the next step is to create a loop that repeats this part of the code but now with row 2, which in this case would be N = 1 +1 = 2 and so on until reaching the number 70000&lt;BR /&gt;&lt;BR /&gt;And to store this information I create a table which I insert all the values I found for N =1 and below N= 2….3…..5……70000</description>
      <pubDate>Mon, 18 Apr 2022 13:17:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/808298#M748</guid>
      <dc:creator>EduardoQuiroz</dc:creator>
      <dc:date>2022-04-18T13:17:44Z</dc:date>
    </item>
    <item>
      <title>Re: ¿Como Crear un Loop  para ejecutar un codigo  N# de Veces?</title>
      <link>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/808299#M749</link>
      <description>&lt;P&gt;None of this requires a loop or a macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Extract from each database all 70000 desired records into a data set. Using PROC SQL, join the two data base extracts and the data in VFAC_TR.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 13:26:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/808299#M749</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-18T13:26:41Z</dc:date>
    </item>
    <item>
      <title>Re: ¿Como Crear un Loop  para ejecutar un codigo  N# de Veces?</title>
      <link>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/808319#M750</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
    create table txn as select
          put(a.cta_cve,19.) as cliente,
          a.cta_fch_prm_cmp as fch_prm_cmp,
          b.fch,
          b.inf,
          b.cve
/* More variables can go here if you want */
    from cta_mes_l as a left join vfac_t as b
         on b.fch_fch=a.fch_prm_cmp
             and b.cta_cve=put(a.cta_cve,19.);
quit;
     &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This is completely untested because I don't have your data sets, and so there may be some modifications needed, but this will do what you want without looping and without macros.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From now on, when you think about using macros and loops, stop and ask yourself (and ask others in this forum or other who you work with) if macros are need and if loops are needed. Macros are incredibly inefficient here, and take a lot longer to program properly.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 14:49:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/808319#M750</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-04-18T14:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: ¿Como Crear un Loop  para ejecutar un codigo  N# de Veces?</title>
      <link>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/808626#M751</link>
      <description>&lt;P&gt;Saludos estimado, si resolviste tu problema de los ciclos? Yo tengo algunos ejemplos que realizamos para cuando generamos información retroactiva por años y requerimos información por meses, igual podría servirte, quedo a la orden &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2022 17:21:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Forum-en-espa%C3%B1ol/Como-Crear-un-Loop-para-ejecutar-un-codigo-N-de-Veces/m-p/808626#M751</guid>
      <dc:creator>adrianet86</dc:creator>
      <dc:date>2022-04-19T17:21:25Z</dc:date>
    </item>
  </channel>
</rss>

