<?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: print list of values in line by line in into clause in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/print-list-of-values-in-line-by-line-in-into-clause/m-p/934368#M367423</link>
    <description>&lt;P&gt;Why so complicated? A simple SELECT will do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select name from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 02 Jul 2024 08:21:18 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2024-07-02T08:21:18Z</dc:date>
    <item>
      <title>print list of values in line by line in into clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/print-list-of-values-in-line-by-line-in-into-clause/m-p/934366#M367421</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  select name into :mvar1 - :mvar99  
  from sashelp.class
  ;
quit;

%macro printMvars();
  %do i=1 %to &amp;amp;sqlobs;
    %put &amp;amp;&amp;amp;mvar&amp;amp;i;
  %end;
%mend;
%printMvars()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;i want to print list of values&amp;nbsp; line by line without macro do loop&amp;nbsp; using proc sql into clause block only&amp;nbsp;&lt;/P&gt;
&lt;P&gt;required output&lt;/P&gt;
&lt;P&gt;Alfred&lt;BR /&gt;Alice&lt;BR /&gt;Barbara&lt;BR /&gt;Carol&lt;BR /&gt;Henry&lt;BR /&gt;James&lt;BR /&gt;Jane&lt;BR /&gt;Janet&lt;BR /&gt;Jeffrey&lt;BR /&gt;John&lt;BR /&gt;Joyce&lt;BR /&gt;Judy&lt;BR /&gt;Louise&lt;BR /&gt;Mary&lt;BR /&gt;Philip&lt;BR /&gt;Robert&lt;BR /&gt;Ronald&lt;BR /&gt;Thomas&lt;BR /&gt;William&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 07:28:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/print-list-of-values-in-line-by-line-in-into-clause/m-p/934366#M367421</guid>
      <dc:creator>pavank</dc:creator>
      <dc:date>2024-07-02T07:28:54Z</dc:date>
    </item>
    <item>
      <title>Re: print list of values in line by line in into clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/print-list-of-values-in-line-by-line-in-into-clause/m-p/934368#M367423</link>
      <description>&lt;P&gt;Why so complicated? A simple SELECT will do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select name from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jul 2024 08:21:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/print-list-of-values-in-line-by-line-in-into-clause/m-p/934368#M367423</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2024-07-02T08:21:18Z</dc:date>
    </item>
    <item>
      <title>Re: print list of values in line by line in into clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/print-list-of-values-in-line-by-line-in-into-clause/m-p/934384#M367425</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/390518"&gt;@pavank&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  select name into :mvar1 - :mvar99  
  from sashelp.class
  ;
quit;

%macro printMvars();
  %do i=1 %to &amp;amp;sqlobs;
    %put &amp;amp;&amp;amp;mvar&amp;amp;i;
  %end;
%mend;
%printMvars()&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;i want to print list of values&amp;nbsp; line by line without macro do loop&amp;nbsp; using proc sql into clause block only&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why do you even specify using SQL and macros here? You make your programming harder by specifying it has to be done a certain way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could use PROC PRINT. You should be specifying the output you want, rather than using a specific PROC and the INTO clause.&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2024 10:32:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/print-list-of-values-in-line-by-line-in-into-clause/m-p/934384#M367425</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-07-02T10:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: print list of values in line by line in into clause</title>
      <link>https://communities.sas.com/t5/SAS-Programming/print-list-of-values-in-line-by-line-in-into-clause/m-p/934393#M367432</link>
      <description>&lt;P&gt;If the goal is to list the name to the SAS log then skip the SQL and the macro code code.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set sashelp.class;
  put name;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have a set of macro variables with a common prefix and numeric suffix then you can also print them to the log using a data step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  do i=1 to &amp;amp;sqlobs;
       value = symget(cats('mvar',i));
       put value;
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jul 2024 12:53:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/print-list-of-values-in-line-by-line-in-into-clause/m-p/934393#M367432</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-07-02T12:53:57Z</dc:date>
    </item>
  </channel>
</rss>

