<?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 anybody helps to explain what %let means here and the scan function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/anybody-helps-to-explain-what-let-means-here-and-the-scan/m-p/287175#M59050</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro uo;
%do i = 1 %to 9;
data a.nc;
%let setname = %scan(9 8 7 6 5 4 3 2 1, &amp;amp;i);
%if &amp;amp;i = 1 %then %do;
update a.data&amp;amp;setname  (keep = v1 v2)
       a.data10        (keep = v1 v2); 
%end;
%else %if &amp;amp;i &amp;gt; 1 %then %do;
update a.nc
	   a.data&amp;amp;setname (keep = v1 v2);
%end;
by v1;
run;
%end;
%mend;

%uo;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am studying some sas programs and cannot understand the %let, %scan. Can anybody help to explain in details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot&lt;/P&gt;</description>
    <pubDate>Tue, 26 Jul 2016 13:22:47 GMT</pubDate>
    <dc:creator>Bal23</dc:creator>
    <dc:date>2016-07-26T13:22:47Z</dc:date>
    <item>
      <title>anybody helps to explain what %let means here and the scan function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anybody-helps-to-explain-what-let-means-here-and-the-scan/m-p/287175#M59050</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro uo;
%do i = 1 %to 9;
data a.nc;
%let setname = %scan(9 8 7 6 5 4 3 2 1, &amp;amp;i);
%if &amp;amp;i = 1 %then %do;
update a.data&amp;amp;setname  (keep = v1 v2)
       a.data10        (keep = v1 v2); 
%end;
%else %if &amp;amp;i &amp;gt; 1 %then %do;
update a.nc
	   a.data&amp;amp;setname (keep = v1 v2);
%end;
by v1;
run;
%end;
%mend;

%uo;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am studying some sas programs and cannot understand the %let, %scan. Can anybody help to explain in details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks a lot&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 13:22:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anybody-helps-to-explain-what-let-means-here-and-the-scan/m-p/287175#M59050</guid>
      <dc:creator>Bal23</dc:creator>
      <dc:date>2016-07-26T13:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: anybody helps to explain what %let means here and the scan function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anybody-helps-to-explain-what-let-means-here-and-the-scan/m-p/287179#M59052</link>
      <description>In macro language, %let is use to set the value of a variable into something.&lt;BR /&gt;For example, &lt;BR /&gt;%let i=1;&lt;BR /&gt;will set the macro variable i to 1, so when you write &amp;amp;i. will be replaced by 1.&lt;BR /&gt;%scan do the same that a scan function in a data step. In that case, select the &amp;amp;i word, separated by default separators.</description>
      <pubDate>Tue, 26 Jul 2016 13:30:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anybody-helps-to-explain-what-let-means-here-and-the-scan/m-p/287179#M59052</guid>
      <dc:creator>arodriguez</dc:creator>
      <dc:date>2016-07-26T13:30:08Z</dc:date>
    </item>
    <item>
      <title>Re: anybody helps to explain what %let means here and the scan function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anybody-helps-to-explain-what-let-means-here-and-the-scan/m-p/287230#M59060</link>
      <description>&lt;P&gt;The SAS Macro Reference is a great resource for questions about specific statements and functions:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543704.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a000543704.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#z3514scan.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#z3514scan.htm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 15:08:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anybody-helps-to-explain-what-let-means-here-and-the-scan/m-p/287230#M59060</guid>
      <dc:creator>rayIII</dc:creator>
      <dc:date>2016-07-26T15:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: anybody helps to explain what %let means here and the scan function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/anybody-helps-to-explain-what-let-means-here-and-the-scan/m-p/287271#M59076</link>
      <description>&lt;P&gt;Looks like they want SETNAME to go from 9 down to 1. Instead of the using that strange %SCAN() funciton they could have just used arithmetic to convert I to SETNAME.&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let setname=%eval(10-&amp;amp;i);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;They could have alos just use SETNAME in the&amp;nbsp;%DO loop direcly.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%do setname = 9 %to 1 %by -1;
data a.nc;
%if &amp;amp;setname=9 %then %do;
update a.data&amp;amp;setname  (keep = v1 v2)
       a.data10        (keep = v1 v2); 
%end;
%else %do;
update a.nc
	   a.data&amp;amp;setname (keep = v1 v2);
%end;
by v1;
run;
%end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jul 2016 17:07:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/anybody-helps-to-explain-what-let-means-here-and-the-scan/m-p/287271#M59076</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-07-26T17:07:51Z</dc:date>
    </item>
  </channel>
</rss>

