<?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: Creating a list of indexed names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246006#M45974</link>
    <description>&lt;P&gt;Are you trying to put a list of variable names from a table that already exists into a macro variable? Or, are you trying to create a table with a list of variable names?&lt;/P&gt;</description>
    <pubDate>Mon, 25 Jan 2016 21:49:35 GMT</pubDate>
    <dc:creator>DanZ</dc:creator>
    <dc:date>2016-01-25T21:49:35Z</dc:date>
    <item>
      <title>Creating a list of indexed names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246002#M45972</link>
      <description>&lt;P&gt;&lt;SPAN&gt;May somebody help me with SAS syntax.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I would like to create a list&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;%let listVars = a1|a2|a3|a4|a5;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;OR a dataset&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;dataset myListVars;&lt;/DIV&gt;&lt;DIV&gt;input item $32.;&lt;/DIV&gt;&lt;DIV&gt;dataline;&lt;/DIV&gt;&lt;DIV&gt;a1&lt;/DIV&gt;&lt;DIV&gt;a2&lt;/DIV&gt;&lt;DIV&gt;a3&lt;/DIV&gt;&lt;DIV&gt;a4&lt;/DIV&gt;&lt;DIV&gt;a5&lt;/DIV&gt;&lt;DIV&gt;;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;How can I do it without listing ALL names. Is it possible to do something like:&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;%let listVars = a1 – a5;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;OR&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;dataset myListVars;&lt;/DIV&gt;&lt;DIV&gt;input item $32.;&lt;/DIV&gt;&lt;DIV&gt;dataline;&lt;/DIV&gt;&lt;DIV&gt;a1 - a5&lt;/DIV&gt;&lt;DIV&gt;;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thank you&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Julia&lt;/DIV&gt;</description>
      <pubDate>Mon, 25 Jan 2016 21:43:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246002#M45972</guid>
      <dc:creator>braverju</dc:creator>
      <dc:date>2016-01-25T21:43:59Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list of indexed names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246004#M45973</link>
      <description>&lt;P&gt;What are you planning to use this for down the line?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could use a loop, but there's probably better ways to do whatever you're trying to do is my guess.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
&amp;nbsp; &amp;nbsp; &amp;nbsp;do i=1 to 99;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Item=catt("A", put(i, z2.));
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; output;
&amp;nbsp; &amp;nbsp; &amp;nbsp;end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 21:47:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246004#M45973</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-01-25T21:47:54Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list of indexed names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246006#M45974</link>
      <description>&lt;P&gt;Are you trying to put a list of variable names from a table that already exists into a macro variable? Or, are you trying to create a table with a list of variable names?&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 21:49:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246006#M45974</guid>
      <dc:creator>DanZ</dc:creator>
      <dc:date>2016-01-25T21:49:35Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list of indexed names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246008#M45975</link>
      <description>&lt;P&gt;Once you have the dataset, creating the macro variable is easy, too:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data myListVars;
length item $32;
do _n_=1 to 5;
  item=cats('a',_n_);
  output;
end;
run;

proc sql noprint;
select *
into :listvars separated by '|'
from myListVars;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 25 Jan 2016 21:56:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246008#M45975</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-01-25T21:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list of indexed names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246011#M45976</link>
      <description>&lt;P&gt;Thank you very much. This is exactly what I need. I just didn't know the first part.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 22:08:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246011#M45976</guid>
      <dc:creator>braverju</dc:creator>
      <dc:date>2016-01-25T22:08:21Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list of indexed names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246013#M45977</link>
      <description>&lt;P&gt;You're welcome. But if you only need the macro variable, you can get it even more easily:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
array x[5] (1:5);
call symputx('listvars', 'a'||catx('|a', of x:));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 22:12:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246013#M45977</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2016-01-25T22:12:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating a list of indexed names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246015#M45978</link>
      <description>&lt;P&gt;Thank you! Even better!&lt;/P&gt;</description>
      <pubDate>Mon, 25 Jan 2016 22:51:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Creating-a-list-of-indexed-names/m-p/246015#M45978</guid>
      <dc:creator>braverju</dc:creator>
      <dc:date>2016-01-25T22:51:22Z</dc:date>
    </item>
  </channel>
</rss>

