<?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: want to disply all values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/want-to-disply-all-values/m-p/336708#M76358</link>
    <description>&lt;P&gt;It's hard to provide a solution without any input&amp;nbsp;data to work with or desired output data to look at. Can you send that along with the code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have specified only one macro variable per column you are selecting. So&amp;nbsp;the query&amp;nbsp;takes the values from the two columns from the &lt;EM&gt;first row only&lt;/EM&gt;&amp;nbsp;and puts them in those two macro variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you trying to print all column names from a dataset in one long string? Like this: ds1 has var1, var2, var3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or do you want to print something like this in the log?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ds1 has var1&lt;/P&gt;&lt;P&gt;ds1 has var2&lt;/P&gt;&lt;P&gt;ds1 has var3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a solution for the second option above:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select count(*) into :rowcount trimmed
from dictionary.columns
where libname="RAW"
and (name like '%AT') ;
quit;

proc sql;
select mem,name into :ds1-:ds&amp;amp;rowcount., :var1-:var&amp;amp;rowcount.
from dictionary.columns
where libname="RAW"
and (name like '%AT') ;
quit;

%macro loop;
 %do i= 1 %to &amp;amp;rowcount.;
  %put "&amp;amp;&amp;amp;ds&amp;amp;i" have "&amp;amp;&amp;amp;var&amp;amp;i";
%end;
%mend;

%loop;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 28 Feb 2017 20:30:29 GMT</pubDate>
    <dc:creator>nehalsanghvi</dc:creator>
    <dc:date>2017-02-28T20:30:29Z</dc:date>
    <item>
      <title>want to disply all values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-disply-all-values/m-p/336701#M76357</link>
      <description>&lt;P&gt;i want to display all values in macro.its taking only 1st value&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select mem ,name into:ds,:var&amp;nbsp; from dictionary.columns&lt;BR /&gt;where libname="RAW" and (name like '%AT' ') ;&lt;BR /&gt;quit;&lt;BR /&gt;proc sql;&lt;BR /&gt;select count(name)into:N from demo;&lt;BR /&gt;quit;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;%macro loop(N,ds,var);&lt;BR /&gt;&amp;nbsp;%do i= 1 %to &amp;amp;N;&lt;BR /&gt;&amp;nbsp; %put "&amp;amp;ds" -"&amp;amp;var";&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;%end;&lt;BR /&gt;&lt;BR /&gt;%mend;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 20:06:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-disply-all-values/m-p/336701#M76357</guid>
      <dc:creator>paddyb</dc:creator>
      <dc:date>2017-02-28T20:06:59Z</dc:date>
    </item>
    <item>
      <title>Re: want to disply all values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-disply-all-values/m-p/336708#M76358</link>
      <description>&lt;P&gt;It's hard to provide a solution without any input&amp;nbsp;data to work with or desired output data to look at. Can you send that along with the code?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have specified only one macro variable per column you are selecting. So&amp;nbsp;the query&amp;nbsp;takes the values from the two columns from the &lt;EM&gt;first row only&lt;/EM&gt;&amp;nbsp;and puts them in those two macro variables.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you trying to print all column names from a dataset in one long string? Like this: ds1 has var1, var2, var3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Or do you want to print something like this in the log?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ds1 has var1&lt;/P&gt;&lt;P&gt;ds1 has var2&lt;/P&gt;&lt;P&gt;ds1 has var3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's a solution for the second option above:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select count(*) into :rowcount trimmed
from dictionary.columns
where libname="RAW"
and (name like '%AT') ;
quit;

proc sql;
select mem,name into :ds1-:ds&amp;amp;rowcount., :var1-:var&amp;amp;rowcount.
from dictionary.columns
where libname="RAW"
and (name like '%AT') ;
quit;

%macro loop;
 %do i= 1 %to &amp;amp;rowcount.;
  %put "&amp;amp;&amp;amp;ds&amp;amp;i" have "&amp;amp;&amp;amp;var&amp;amp;i";
%end;
%mend;

%loop;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Feb 2017 20:30:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-disply-all-values/m-p/336708#M76358</guid>
      <dc:creator>nehalsanghvi</dc:creator>
      <dc:date>2017-02-28T20:30:29Z</dc:date>
    </item>
    <item>
      <title>Re: want to disply all values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-disply-all-values/m-p/336710#M76359</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
select memname into:ds separated by " " from dictionary.columns
where libname="RAW" and (name like '%AT');
select name into:var separated by " " from dictionary.columns
where libname="RAW" and (name like '%AT');
quit;

%macro loop;
%do i = 1 %to %sysfunc(countw(&amp;amp;ds));
  %put %scan(&amp;amp;ds,&amp;amp;i) -%scan(&amp;amp;var,&amp;amp;i);
%end;
%mend;
%loop&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Feb 2017 20:32:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-disply-all-values/m-p/336710#M76359</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-02-28T20:32:09Z</dc:date>
    </item>
    <item>
      <title>Re: want to disply all values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-disply-all-values/m-p/336720#M76362</link>
      <description>&lt;P&gt;yes something similar.it worked.Thanks you&lt;/P&gt;</description>
      <pubDate>Tue, 28 Feb 2017 20:44:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-disply-all-values/m-p/336720#M76362</guid>
      <dc:creator>paddyb</dc:creator>
      <dc:date>2017-02-28T20:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: want to disply all values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/want-to-disply-all-values/m-p/336761#M76374</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;I have not paid much attention to this post so maybe I am off base, but this seems to work

* create some data;
libname sd1 "d:/sd1";
data sd1.xat(keep=sat rat bat) sd1.zat(keep= hat fat);
  retain sat rat bat hat fat 0;
run;quit;

proc sql;
  select
     catx('-',memname,name)
  into
    :libnam separated by " "
  from
    dictionary.columns
  where
         libname="SD1"
     and (name like '%AT')
;quit;

 XAT-SAT
 XAT-RAT
 XAT-BAT
 ZAT-HAT
 ZAT-FAT


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 28 Feb 2017 22:18:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/want-to-disply-all-values/m-p/336761#M76374</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2017-02-28T22:18:08Z</dc:date>
    </item>
  </channel>
</rss>

