<?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: Resolving Ampersands Partially? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Resolving-Ampersands-Partially/m-p/583000#M165912</link>
    <description>&lt;P&gt;Much appreciate. This was what I thought.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro repeat;

%do pagenumber=1 %to 5;

filename tempfile temp;

proc http method="get" out=tempfile
	url="https://www.walmart.com/search/?cat_id=0%str(&amp;amp;)page=&amp;amp;pagenumber.%str(&amp;amp;)ps=40%str(&amp;amp;)query=chobani#searchProductResult";
run;

data output&amp;amp;pagenumber.;
	infile tempfile length=length lrecl=32767;
	input line $varying32767. length;
run;

%end;

%mend;

%repeat;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2019 20:59:40 GMT</pubDate>
    <dc:creator>Junyong</dc:creator>
    <dc:date>2019-08-21T20:59:40Z</dc:date>
    <item>
      <title>Resolving Ampersands Partially?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolving-Ampersands-Partially/m-p/582988#M165906</link>
      <description>&lt;P&gt;When there are multiple ampersands in one double-quoted string, can one resolve only some of them leaving others unresolved? For example,&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro repeat;

%do pagenumber=1 %to 5;

filename tempfile temp;

proc http method="get" out=tempfile
	url="https://www.walmart.com/search/?cat_id=0&amp;amp;page=&amp;amp;pagenumber.&amp;amp;ps=40&amp;amp;query=chobani#searchProductResult";
run;

data output&amp;amp;pagenumber.;
	infile tempfile length=length lrecl=32767;
	input line $varying32767. length;
run;

%end;

%mend;

%repeat;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Since PROC HTTP requires a string for URL, I put a double-quoted string, which resolves all ampersands. If there is a macro variable such as QUERY, then SAS resolves it as the string has &amp;amp;QUERY. I need to only resolve PAGENUMBER since iterate, but don't want to resolve anything else. How can I distinguish those different ampersands? I tried to combine a single-quoted string and a double-quoted one by ||, but didn't work well. Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:29:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolving-Ampersands-Partially/m-p/582988#M165906</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2019-08-21T20:29:50Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving Ampersands Partially?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolving-Ampersands-Partially/m-p/582989#M165907</link>
      <description>&lt;P&gt;Why not build up the string from the pieces and use the QUOTE() function to enclose it in single quotes.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro repeat;
%local pagenumber url ;
%do pagenumber=1 %to 5;
  filename tempfile temp;

  data _null_;
    call symputx(url,quote(cats
      ('https://www.walmart.com/search/?cat_id=0&amp;amp;page='
      ,"&amp;amp;pagenumber"
      ,'&amp;amp;ps=40&amp;amp;query=chobani#searchProductResult'
      ),"'"))
    ;
  run;

  proc http method="get" out=tempfile url=&amp;amp;url ;
  run;

  data output&amp;amp;pagenumber.;
    infile tempfile truncover ;
    input line $char32767.;
  run;

%end;

%mend;

%repeat;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:41:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolving-Ampersands-Partially/m-p/582989#M165907</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-21T20:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving Ampersands Partially?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolving-Ampersands-Partially/m-p/582990#M165908</link>
      <description>Thanks. I used something similar with %LET and %NRSTR, but wondered whether one can shorten this by '&lt;A href="https://www.walmart.com/search/?cat_id=0&amp;amp;page='||&amp;quot;&amp;amp;pagenumber&amp;quot;||'&amp;amp;ps=40&amp;amp;query=chobani#searchProductResult" target="_blank"&gt;https://www.walmart.com/search/?cat_id=0&amp;amp;page='||"&amp;amp;pagenumber"||'&amp;amp;ps=40&amp;amp;query=chobani#searchProductResult&lt;/A&gt;' or something like \&amp;amp;.</description>
      <pubDate>Wed, 21 Aug 2019 20:46:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolving-Ampersands-Partially/m-p/582990#M165908</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2019-08-21T20:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving Ampersands Partially?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolving-Ampersands-Partially/m-p/582997#M165911</link>
      <description>%let x=%str(&amp;amp;)page;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:55:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolving-Ampersands-Partially/m-p/582997#M165911</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-08-21T20:55:29Z</dc:date>
    </item>
    <item>
      <title>Re: Resolving Ampersands Partially?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Resolving-Ampersands-Partially/m-p/583000#M165912</link>
      <description>&lt;P&gt;Much appreciate. This was what I thought.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro repeat;

%do pagenumber=1 %to 5;

filename tempfile temp;

proc http method="get" out=tempfile
	url="https://www.walmart.com/search/?cat_id=0%str(&amp;amp;)page=&amp;amp;pagenumber.%str(&amp;amp;)ps=40%str(&amp;amp;)query=chobani#searchProductResult";
run;

data output&amp;amp;pagenumber.;
	infile tempfile length=length lrecl=32767;
	input line $varying32767. length;
run;

%end;

%mend;

%repeat;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2019 20:59:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Resolving-Ampersands-Partially/m-p/583000#M165912</guid>
      <dc:creator>Junyong</dc:creator>
      <dc:date>2019-08-21T20:59:40Z</dc:date>
    </item>
  </channel>
</rss>

