<?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 can I resolve 1 macro variable but not another? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-1-macro-variable-but-not-another/m-p/832533#M329068</link>
    <description>&lt;P&gt;Add macro quoting.&lt;/P&gt;
&lt;PRE&gt;58   %let ACS_YEAR=2020;
59   %put "https://api.census.gov/data/&amp;amp;ACS_YEAR/acs/acs5?get=NAME,B01001_001E%str(&amp;amp;)for=state:01" ;
"https://api.census.gov/data/2020/acs/acs5?get=NAME,B01001_001E&amp;amp;for=state:01"
&lt;/PRE&gt;</description>
    <pubDate>Fri, 09 Sep 2022 16:43:21 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-09-09T16:43:21Z</dc:date>
    <item>
      <title>How can I resolve 1 macro variable but not another?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-1-macro-variable-but-not-another/m-p/832531#M329066</link>
      <description>&lt;P&gt;I am using a program to download data from the Census API. I can successfully download the data, however, I am receiving a warning message:&amp;nbsp;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference FOR not resolved.&lt;/P&gt;&lt;P&gt;The reason is that the syntax required for the GET request requires a &amp;amp;for clause to define geographic parameters. In the example below, the request is for the total population of Alabama according to 5-year ACS estimates from the 2016-2020 survey. However, I &lt;EM&gt;do&amp;nbsp;&lt;/EM&gt;want to resolve a macro parameter ACS_YEAR in that same URL string.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;%let ACS_YEAR=2020;
filename hdrs TEMP;
filename out TEMP;

proc http
url="https://api.census.gov/data/&amp;amp;ACS_YEAR/acs/acs5?get=NAME,B01001_001E&amp;amp;for=state:01"
method="GET"
out=out
headerout=hdrs;
run;

DATA TEST;
INFILE OUT DLM = ',' FIRSTOBS = 2;
INPUT B01001_001E $ state $;
RUN;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I tried to add %LET FOR=&amp;amp;FOR thinking that FOR would resolve to &amp;amp;FOR but that resulted in an error.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 16:25:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-1-macro-variable-but-not-another/m-p/832531#M329066</guid>
      <dc:creator>benjamin_2018</dc:creator>
      <dc:date>2022-09-09T16:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: How can I resolve 1 macro variable but not another?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-1-macro-variable-but-not-another/m-p/832532#M329067</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;url="https://api.census.gov/data/&amp;amp;ACS_YEAR/acs/acs5?get=NAME,B01001_001E%nrstr(&amp;amp;for)=state:01"
&lt;/PRE&gt;
&lt;P&gt;The %nrstr macro function masks special characters&amp;nbsp; like the &amp;amp; from being processed by the macro processor. Likely could just use the %nrstr(&amp;amp;) but I think including the "for" as well may make it easier to follow later why the mask is needed.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Sep 2022 16:43:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-1-macro-variable-but-not-another/m-p/832532#M329067</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2022-09-09T16:43:11Z</dc:date>
    </item>
    <item>
      <title>Re: How can I resolve 1 macro variable but not another?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-1-macro-variable-but-not-another/m-p/832533#M329068</link>
      <description>&lt;P&gt;Add macro quoting.&lt;/P&gt;
&lt;PRE&gt;58   %let ACS_YEAR=2020;
59   %put "https://api.census.gov/data/&amp;amp;ACS_YEAR/acs/acs5?get=NAME,B01001_001E%str(&amp;amp;)for=state:01" ;
"https://api.census.gov/data/2020/acs/acs5?get=NAME,B01001_001E&amp;amp;for=state:01"
&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Sep 2022 16:43:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-can-I-resolve-1-macro-variable-but-not-another/m-p/832533#M329068</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-09-09T16:43:21Z</dc:date>
    </item>
  </channel>
</rss>

