<?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: putting row values into a list in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299119#M63001</link>
    <description>&lt;P&gt;Hi PGStats,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks for the reply, but is it possible to have a solution with the list becasue the example that I have put is an oversimplification and my real data is more complicated than that, and it will be really helpful if I could create a data table by inputting a list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
    <pubDate>Sat, 17 Sep 2016 20:25:12 GMT</pubDate>
    <dc:creator>ilikesas</dc:creator>
    <dc:date>2016-09-17T20:25:12Z</dc:date>
    <item>
      <title>putting row values into a list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299117#M62999</link>
      <description>&lt;P&gt;&amp;nbsp;hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppsoe I have the following table:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" span="2" width="64" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;id&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;num&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;1&lt;/TD&gt;
&lt;TD align="right"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD align="right"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;2&lt;/TD&gt;
&lt;TD align="right"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;5&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First I would like to get the rows where the id has a num = 1 and this is easily done:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data have1;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if num = 1;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and I get the following data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" span="2" width="64" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;id&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;num&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;5&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Now what I want is to get the ids 3,4 and 5 into a list like this when I run the following pseudo-code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;set have;&lt;/P&gt;
&lt;P&gt;if id in list; &amp;nbsp; &amp;nbsp; &amp;nbsp; I know this line has a wrong syntax, its just for the purpose of illustration&lt;/P&gt;
&lt;P&gt;run;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I get the final data:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 96pt;" border="0" width="128" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 48pt;" span="2" width="64" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD width="64" height="20" style="height: 15.0pt; width: 48pt;"&gt;id&lt;/TD&gt;
&lt;TD width="64" style="width: 48pt;"&gt;num&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;3&lt;/TD&gt;
&lt;TD align="right"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;4&lt;/TD&gt;
&lt;TD align="right"&gt;0&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 15.0pt;"&gt;
&lt;TD height="20" align="right" style="height: 15.0pt;"&gt;5&lt;/TD&gt;
&lt;TD align="right"&gt;1&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So this data has all the original ids that have a num=1 &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thnaks!&lt;/P&gt;</description>
      <pubDate>Sat, 17 Sep 2016 20:07:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299117#M62999</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2016-09-17T20:07:58Z</dc:date>
    </item>
    <item>
      <title>Re: putting row values into a list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299118#M63000</link>
      <description>&lt;P&gt;Do both operations at once:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
select * from have
group by id
having max(num=1)=1;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 17 Sep 2016 20:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299118#M63000</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-09-17T20:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: putting row values into a list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299119#M63001</link>
      <description>&lt;P&gt;Hi PGStats,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks for the reply, but is it possible to have a solution with the list becasue the example that I have put is an oversimplification and my real data is more complicated than that, and it will be really helpful if I could create a data table by inputting a list.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sat, 17 Sep 2016 20:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299119#M63001</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2016-09-17T20:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: putting row values into a list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299122#M63002</link>
      <description>&lt;P&gt;Use SQL and IN with a sub-query.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;PROC SQL;
Select *
From have
Where id in (select distinct ID from have where num=1);
Quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 17 Sep 2016 22:39:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299122#M63002</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-17T22:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: putting row values into a list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299127#M63007</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I managed to put the values in a list in the following way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sql;&lt;BR /&gt; select /*distinct*/ id&lt;BR /&gt; into :id separated by ', '&lt;BR /&gt; from&amp;nbsp;have1&lt;BR /&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then I wanted to use your code, which works greatly as it is, to do something like this:&lt;/P&gt;
&lt;P&gt;PROC SQL;&lt;BR /&gt;Select *&lt;BR /&gt;From&amp;nbsp;have&lt;BR /&gt;Where id in ( select &amp;amp;id);&lt;BR /&gt;Quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I got an error message. Is it even possible to use list macro variables in this way?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Sun, 18 Sep 2016 00:38:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299127#M63007</guid>
      <dc:creator>ilikesas</dc:creator>
      <dc:date>2016-09-18T00:38:34Z</dc:date>
    </item>
    <item>
      <title>Re: putting row values into a list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299130#M63010</link>
      <description>&lt;P&gt;change the where statement in your last step to:&lt;/P&gt;&lt;P&gt;where ID in (&amp;amp;id) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/* drop the "select" */&lt;/P&gt;</description>
      <pubDate>Sun, 18 Sep 2016 00:56:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299130#M63010</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2016-09-18T00:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: putting row values into a list</title>
      <link>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299131#M63011</link>
      <description>&lt;P&gt;You can, but you don't gain anything by using macro variables in this case.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 18 Sep 2016 01:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/putting-row-values-into-a-list/m-p/299131#M63011</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-09-18T01:00:29Z</dc:date>
    </item>
  </channel>
</rss>

