<?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: read values stord in macro variables into a data set in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264655#M51946</link>
    <description>&lt;P&gt;Thank you very much for both replies. Both works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 18 Apr 2016 19:22:43 GMT</pubDate>
    <dc:creator>fengyuwuzu</dc:creator>
    <dc:date>2016-04-18T19:22:43Z</dc:date>
    <item>
      <title>read values stord in macro variables into a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264648#M51940</link>
      <description>&lt;P&gt;I have 3 data sets, A, B and C and want to compare the total count of them.&lt;/P&gt;
&lt;P&gt;I created a number of macro variables by "select into" in proc sql, and want to use these values to make a report.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example, I have three macro variables, count_A, count_B, and count_C, and want to report them in a table like:&lt;/P&gt;
&lt;P&gt;type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; count&lt;/P&gt;
&lt;P&gt;type_A&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;count_A&lt;/P&gt;
&lt;P&gt;type_B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;count_B&lt;/P&gt;
&lt;P&gt;type_C&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;count_C&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need to read in the values stored in the macro variables. Can they be used in datalines? Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 18:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264648#M51940</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-04-18T18:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: read values stord in macro variables into a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264652#M51943</link>
      <description>&lt;P&gt;No, not within datalines, but that shouldn't stop you.&amp;nbsp; A DATA step could proceed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;type='Type A'; count = &amp;amp;count_a; output;&lt;/P&gt;
&lt;P&gt;type='Type B'; count = &amp;amp;count_b; output;&lt;/P&gt;
&lt;P&gt;type='Type C'; count = &amp;amp;count_c; output;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 19:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264652#M51943</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2016-04-18T19:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: read values stord in macro variables into a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264653#M51944</link>
      <description>&lt;P&gt;How many do you have in reality?&lt;/P&gt;
&lt;P&gt;Do you want 3 observaions with the values in one variable, one observation with three variables and the values or something else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm sure I can force something into datalines but if you do not want all of the values as a single variable in multiple observations it would be a lot of work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would ask where are these macro variables coming from? It may be easier to address at that point then kluding elsewhere.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To create a set with 3 variables:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Data want;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; type_A&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;nbsp; "&amp;amp;count_A";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; type_B&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;nbsp;&amp;nbsp;"&amp;amp;count_B";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; type_C&amp;nbsp;&amp;nbsp;&amp;nbsp;=&amp;nbsp;&amp;nbsp;&amp;nbsp;"&amp;amp;count_C;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Assuming the values are character. Skip the quote marks if the values are always numeric (or . or the special missing tags).&lt;/P&gt;
&lt;P&gt;If you want to control the length of the variables for use, such as merging with another set, then add a length statement before the assignment.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 19:17:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264653#M51944</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-04-18T19:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: read values stord in macro variables into a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264655#M51946</link>
      <description>&lt;P&gt;Thank you very much for both replies. Both works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2016 19:22:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264655#M51946</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-04-18T19:22:43Z</dc:date>
    </item>
    <item>
      <title>Re: read values stord in macro variables into a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264658#M51948</link>
      <description>&lt;P&gt;No need for macros. Why not use dictionary.tables&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table setSizes as
select memname "Type", nobs "Count"
from dictionary.tables
where libname="SASHELP" and memname in ("CLASS","CARS","IRIS");
select * from setSizes;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Apr 2016 19:44:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264658#M51948</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-04-18T19:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: read values stord in macro variables into a data set</title>
      <link>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264809#M51998</link>
      <description>&lt;P&gt;Thank you very much, &lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;A id="link_34" class="lia-link-navigation lia-page-link lia-user-name-link" style="color: #009999;" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462" target="_self"&gt;&lt;SPAN class="login-bold"&gt;PGStats&lt;/SPAN&gt;&lt;/A&gt;&lt;/SPAN&gt;, for your nice idea and sample code.&lt;/P&gt;
&lt;P&gt;I love this community. Everytime I asked a question I learned a lot more than I expected.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Apr 2016 15:28:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/read-values-stord-in-macro-variables-into-a-data-set/m-p/264809#M51998</guid>
      <dc:creator>fengyuwuzu</dc:creator>
      <dc:date>2016-04-19T15:28:42Z</dc:date>
    </item>
  </channel>
</rss>

