<?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: if statement with %let in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-let/m-p/21653#M3496</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For something so simple you can also just use a DATA _NULL_ step and not bother with macro language.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let type=color;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let varlist=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if "&amp;amp;type" = 'color' then call symput('varlist','red blue');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if "&amp;amp;type" = 'pattern' then call symput('varlist','solid stripe');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data data1 (keep= &amp;amp;varlist);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set datalib.data1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 01 Oct 2011 13:18:46 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2011-10-01T13:18:46Z</dc:date>
    <item>
      <title>if statement with %let</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-let/m-p/21651#M3494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I am new to SAS and am using 9.2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would like to read in variables from a dataset, based on a %let statement. A simplification of the issue follows, but I get an error.&lt;/P&gt;&lt;P&gt;I'd appreciate someone's help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Brent Fulton&lt;/P&gt;&lt;P&gt;UC Berkeley&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let type=color;&lt;/P&gt;&lt;P&gt;if &amp;amp;type='color' then do;&lt;/P&gt;&lt;P&gt;%let varlist=red blue;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if &amp;amp;type='pattern' then do;&lt;/P&gt;&lt;P&gt;%let varlist=solid stripe;&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data data1 (keep= &amp;amp;varlist);&lt;/P&gt;&lt;P&gt;set datalib.data1; &lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Oct 2011 06:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-with-let/m-p/21651#M3494</guid>
      <dc:creator>BrentFulton</dc:creator>
      <dc:date>2011-10-01T06:33:48Z</dc:date>
    </item>
    <item>
      <title>Re: if statement with %let</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-let/m-p/21652#M3495</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe it will help you, but NOTE that you can use %if statement only in %macro xxx; .... %mend xxx; statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro mMain;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let type=color;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if &amp;amp;type=%str(color) %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;%let varlist=red blue;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%if &amp;amp;type=%str(pattern) %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;%let varlist=solid stripe;&lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data data1(keep= &amp;amp;varlist);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set datalib.data1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend mMain;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; %mMain&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Oct 2011 09:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-with-let/m-p/21652#M3495</guid>
      <dc:creator>Hayk</dc:creator>
      <dc:date>2011-10-01T09:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: if statement with %let</title>
      <link>https://communities.sas.com/t5/SAS-Programming/if-statement-with-let/m-p/21653#M3496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For something so simple you can also just use a DATA _NULL_ step and not bother with macro language.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let type=color;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let varlist=;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data _null_;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if "&amp;amp;type" = 'color' then call symput('varlist','red blue');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; if "&amp;amp;type" = 'pattern' then call symput('varlist','solid stripe');&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; height: 8pt;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data data1 (keep= &amp;amp;varlist);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set datalib.data1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 01 Oct 2011 13:18:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/if-statement-with-let/m-p/21653#M3496</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-10-01T13:18:46Z</dc:date>
    </item>
  </channel>
</rss>

