<?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 use macro variable as character value in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-as-character-value/m-p/727851#M226440</link>
    <description>&lt;P&gt;I have a macro variable&amp;nbsp;%let state= CA. How can use it within a macro in a conditional statement.&lt;/P&gt;
&lt;P&gt;I want to create a dataset that is a subset. This does not work:&lt;/P&gt;
&lt;PRE&gt;proc sql;
create table &amp;amp;state. as
select * from &amp;amp;data.(where = (top_states=&amp;amp;state.));
quit;&lt;/PRE&gt;
&lt;P&gt;But this works:&lt;/P&gt;
&lt;PRE&gt;proc sql;
create table &amp;amp;state. as
select * from &amp;amp;data.(where = (top_states='CA'));
quit;&lt;/PRE&gt;
&lt;P&gt;How can I use the &amp;amp;state. macro to subset my data?&lt;/P&gt;</description>
    <pubDate>Fri, 19 Mar 2021 18:57:02 GMT</pubDate>
    <dc:creator>asasha</dc:creator>
    <dc:date>2021-03-19T18:57:02Z</dc:date>
    <item>
      <title>use macro variable as character value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-as-character-value/m-p/727851#M226440</link>
      <description>&lt;P&gt;I have a macro variable&amp;nbsp;%let state= CA. How can use it within a macro in a conditional statement.&lt;/P&gt;
&lt;P&gt;I want to create a dataset that is a subset. This does not work:&lt;/P&gt;
&lt;PRE&gt;proc sql;
create table &amp;amp;state. as
select * from &amp;amp;data.(where = (top_states=&amp;amp;state.));
quit;&lt;/PRE&gt;
&lt;P&gt;But this works:&lt;/P&gt;
&lt;PRE&gt;proc sql;
create table &amp;amp;state. as
select * from &amp;amp;data.(where = (top_states='CA'));
quit;&lt;/PRE&gt;
&lt;P&gt;How can I use the &amp;amp;state. macro to subset my data?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 18:57:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-as-character-value/m-p/727851#M226440</guid>
      <dc:creator>asasha</dc:creator>
      <dc:date>2021-03-19T18:57:02Z</dc:date>
    </item>
    <item>
      <title>Re: use macro variable as character value</title>
      <link>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-as-character-value/m-p/727852#M226441</link>
      <description>&lt;P&gt;Modify as below:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table &amp;amp;state. as
select * from &amp;amp;data.(where = (top_states="&amp;amp;state"));
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Unlike single quotes, the use of double quotes permits the macro compiler to interpret "&amp;amp;state"&amp;nbsp; as "CA".&lt;/P&gt;</description>
      <pubDate>Fri, 19 Mar 2021 19:05:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/use-macro-variable-as-character-value/m-p/727852#M226441</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2021-03-19T19:05:09Z</dc:date>
    </item>
  </channel>
</rss>

