<?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: PROC SQL INTO issue in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-issue/m-p/377385#M90607</link>
    <description>&lt;P&gt;You chopped off the macro definition a little early here.&amp;nbsp; By any chance are you missing a semicolon at the end of the %PUT statement?&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jul 2017 15:20:54 GMT</pubDate>
    <dc:creator>Astounding</dc:creator>
    <dc:date>2017-07-19T15:20:54Z</dc:date>
    <item>
      <title>PROC SQL INTO issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-issue/m-p/377368#M90601</link>
      <description>&lt;P&gt;I have a very strange functional issue.&lt;/P&gt;&lt;P&gt;I have a table of 37 rows, 2 colums:&lt;/P&gt;&lt;PRE&gt;filename	ROWN
P01ADIBP_10188_201610050135_A00000AY.txt	1
P01ADIBP_10206_201610050230_A00000C3.txt	2
P01ADIBP_11006_201610050225_A00000C2.txt	3
P01ADIBP_11206_201610050214_A00000BJ.txt	4
P01ADIBP_11306_201610050208_A00000BA.txt	5
P01ADIBP_11706_201610050232_A00000C8.txt	6
P01ADIBP_12006_201610050139_A00000B0.txt	7
P01ADIBP_12206_201610050209_A00000BC.txt	8
P01ADIBP_12406_201610050204_A00000B5.txt	9
P01ADIBP_12506_201610050217_A00000BS.txt	10
P01ADIBP_12906_201610050210_A00000BE.txt	11
P01ADIBP_13106_201610050210_A00000BD.txt	12
P01ADIBP_13306_201610050218_A00000BQ.txt	13
P01ADIBP_13506_201610050217_A00000BO.txt	14
P01ADIBP_13606_201610050213_A00000BH.txt	15
P01ADIBP_14006_201610050732_A00000DD.txt	16
P01ADIBP_14406_201610050215_A00000BL.txt	17
P01ADIBP_14506_201610050212_A00000BF.txt	18
P01ADIBP_14706_201610050216_A00000BR.txt	19
P01ADIBP_16006_201610050220_A00000BT.txt	20
P01ADIBP_16106_201610050207_A00000B8.txt	21
P01ADIBP_16606_201610050212_A00000BG.txt	22
P01ADIBP_16706_201610050215_A00000BN.txt	23
P01ADIBP_16806_201610050234_A00000CC.txt	24
P01ADIBP_16906_201610050235_A00000CE.txt	25
P01ADIBP_17106_201610050150_A00000B2.txt	26
P01ADIBP_17206_201610050225_A00000BZ.txt	27
P01ADIBP_17806_201610050350_A00000CW.txt	28
P01ADIBP_17906_201610050216_A00000BP.txt	29
P01ADIBP_18106_201610050157_A00000B3.txt	30
P01ADIBP_18206_201610050328_A00000CU.txt	31
P01ADIBP_18306_201610050209_A00000BB.txt	32
P01ADIBP_19106_201610050223_A00000BY.txt	33
P01ADIBP_19406_201610050205_A00000B6.txt	34
P01ADIBP_19506_201610050207_A00000B9.txt	35
P01ADIBP_19806_201610050730_A00000DC.txt	36
P01ADIBP_19906_201610042343_A00000AW.txt	37&lt;/PRE&gt;&lt;P&gt;First the filename, second the rownumber.&lt;/P&gt;&lt;P&gt;The table is called INP_1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now I have a macro:&lt;/P&gt;&lt;PRE&gt;%macro ext_1;
	%let iter = 1;

	%do %while (&amp;amp;iter. &amp;lt;= &amp;amp;nbfile.);
		PROC SQL ; 
			SELECT filename INTO :inputfile  FROM INP_1 WHERE ROWN = &amp;amp;iter.; 
		QUIT;
		%put &amp;amp;inputfile.;
		%let iter = %eval(&amp;amp;iter.+1);
	%end;&lt;BR /&gt;%mend;&lt;/PRE&gt;&lt;P&gt;My macrovariable nbfile = 37.&lt;/P&gt;&lt;P&gt;When I run that I have a visual result&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/10408iFA9876EA9068A7F1/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.PNG" title="Capture.PNG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is ok.&lt;/P&gt;&lt;P&gt;However in the log...following is an extract (from iter = 4 to 6, it is the same before and after):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;[...]
MLOGIC(EXT_1):  %LET (variable name is ITER)
MLOGIC(EXT_1):  %DO %WHILE(&amp;amp;iter. &amp;lt;= &amp;amp;nbfile.) condition is TRUE; loop will iterate again.
MPRINT(EXT_1):   PROC SQL ;
MPRINT(EXT_1):   SELECT filename INTO :inputfile FROM INP_1 WHERE ROWN = 4;
MPRINT(EXT_1):   QUIT;
MLOGIC(EXT_1):  %PUT &amp;amp;inputfile.
P01ADIBP_19906_201610042343_A00000AW.txt
MLOGIC(EXT_1):  %LET (variable name is ITER)
MLOGIC(EXT_1):  %DO %WHILE(&amp;amp;iter. &amp;lt;= &amp;amp;nbfile.) condition is TRUE; loop will iterate again.
MPRINT(EXT_1):   PROC SQL ;
MPRINT(EXT_1):   SELECT filename INTO :inputfile FROM INP_1 WHERE ROWN = 5;
MPRINT(EXT_1):   QUIT;
MLOGIC(EXT_1):  %PUT &amp;amp;inputfile.
P01ADIBP_19906_201610042343_A00000AW.txt
MLOGIC(EXT_1):  %LET (variable name is ITER)
MLOGIC(EXT_1):  %DO %WHILE(&amp;amp;iter. &amp;lt;= &amp;amp;nbfile.) condition is TRUE; loop will iterate again.
MPRINT(EXT_1):   PROC SQL ;
MPRINT(EXT_1):   SELECT filename INTO :inputfile FROM INP_1 WHERE ROWN = 6;
MPRINT(EXT_1):   QUIT;
MLOGIC(EXT_1):  %PUT &amp;amp;inputfile.
P01ADIBP_19906_201610042343_A00000AW.txt
[...]&lt;/PRE&gt;&lt;P&gt;inputfile is always equals to:&lt;/P&gt;&lt;PRE&gt;P01ADIBP_19906_201610042343_A00000AW.txt&lt;/PRE&gt;&lt;P&gt;Which is the last filename of INP_1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Do you know what's wrong here?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 15:22:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-issue/m-p/377368#M90601</guid>
      <dc:creator>FP12</dc:creator>
      <dc:date>2017-07-19T15:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-issue/m-p/377385#M90607</link>
      <description>&lt;P&gt;You chopped off the macro definition a little early here.&amp;nbsp; By any chance are you missing a semicolon at the end of the %PUT statement?&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 15:20:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-issue/m-p/377385#M90607</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-07-19T15:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: PROC SQL INTO issue</title>
      <link>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-issue/m-p/377388#M90609</link>
      <description>&lt;P&gt;Indeed,&lt;/P&gt;&lt;P&gt;I just edited my post.&lt;/P&gt;&lt;P&gt;No semicolon missing I think (otherwise it shouldn't run no?)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jul 2017 15:24:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/PROC-SQL-INTO-issue/m-p/377388#M90609</guid>
      <dc:creator>FP12</dc:creator>
      <dc:date>2017-07-19T15:24:06Z</dc:date>
    </item>
  </channel>
</rss>

