<?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: how to convert every observation in to individual macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-every-observation-in-to-individual-macros/m-p/590848#M169161</link>
    <description>&lt;P&gt;Use the Swiss Army Knife of SAS processing, the data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set masterdataset;
call symputx(type,count);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 23 Sep 2019 08:43:49 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-09-23T08:43:49Z</dc:date>
    <item>
      <title>how to convert every observation in to individual macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-every-observation-in-to-individual-macros/m-p/590841#M169158</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I have a dataset named " masterdataset" looks like below&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;type&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;Count&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;A&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;223&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;B&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;123&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;C&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;343&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;D&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;767&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;E&lt;/P&gt;&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;233&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to convert every individual rows in to individual macros. Eg: if i will do %put &amp;amp;=A then the result should be 223.&lt;/P&gt;&lt;P&gt;Tried to do with proc sql , but getting error&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select distinct typeinto :groupA_bign-:groupB_bign from masterdataset;&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;ERROR: The following columns were not found in the contributing tables: masterdataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kindly let me know if there is any other way to do this or how to modify the code to get the result.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 08:24:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-every-observation-in-to-individual-macros/m-p/590841#M169158</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2019-09-23T08:24:13Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert every observation in to individual macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-every-observation-in-to-individual-macros/m-p/590848#M169161</link>
      <description>&lt;P&gt;Use the Swiss Army Knife of SAS processing, the data step:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set masterdataset;
call symputx(type,count);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Sep 2019 08:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-every-observation-in-to-individual-macros/m-p/590848#M169161</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-23T08:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert every observation in to individual macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-every-observation-in-to-individual-macros/m-p/590851#M169162</link>
      <description>Thanks,&lt;BR /&gt;It worked. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; Any comment/valuable inputs on proc sql statement which i have provided?</description>
      <pubDate>Mon, 23 Sep 2019 09:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-every-observation-in-to-individual-macros/m-p/590851#M169162</guid>
      <dc:creator>sahoositaram555</dc:creator>
      <dc:date>2019-09-23T09:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: how to convert every observation in to individual macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-convert-every-observation-in-to-individual-macros/m-p/590858#M169166</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/109034"&gt;@sahoositaram555&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Thanks,&lt;BR /&gt;It worked. &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt; Any comment/valuable inputs on proc sql statement which i have provided?&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;SQL does not support the dynamic creation of macro variable names from dataset columns, so it would be&amp;nbsp;&lt;EM&gt;extremely&lt;/EM&gt; clumsy to somehow re-engineer the call symput(x) function with it:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;determine the number of observations&lt;/LI&gt;
&lt;LI&gt;in a macro do loop:&lt;/LI&gt;
&lt;LI&gt;get the name from a certain observation (using firstobs= and obs= dataset options)&lt;/LI&gt;
&lt;LI&gt;set the value in a similar way, using the name from the previous step&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;This algorithm is just a suggestion, not tested in any way. I'm not sure if the obs= and firstobs= dataset options work in proc sql.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Sep 2019 10:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-convert-every-observation-in-to-individual-macros/m-p/590858#M169166</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-09-23T10:06:44Z</dc:date>
    </item>
  </channel>
</rss>

