<?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: Macro Code in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126992#M294400</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry Reeza.Dont know what you mean.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Ballard&lt;/P&gt;&lt;P&gt;"If you aren't closing and restarting SAS daily then you would have unexpected values.Second is to insure the proper case when comparing using equal signs"&lt;/P&gt;&lt;P&gt;Is it recommended that i restart my SAS daily for Macros in order to work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 01 May 2013 18:02:17 GMT</pubDate>
    <dc:creator>Tal</dc:creator>
    <dc:date>2013-05-01T18:02:17Z</dc:date>
    <item>
      <title>Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126987#M294395</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;The dataset orders gets created ,nothing's wrong my infile but my micro code not working.Anyone knows why,please?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PS.at least for sysday=wed should work but it doesnot. And in additon to this can i use the second code below for the same purpose.Will it work.Can i use automatic macro variables within a sas code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;options mprint;&lt;/P&gt;&lt;P&gt;DATA orders;&lt;/P&gt;&lt;P&gt;INFILE 'C:\Users\Trajce\Contacts\Desktop\Orders.txt';&lt;/P&gt;&lt;P&gt;INPUT CustomerID $ 1-3 OrderDate DATE7. Model $ 13-24 Quantity;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%MACRO reports;&lt;/P&gt;&lt;P&gt;%IF &amp;amp;SYSDAY = Monday %THEN %DO;&lt;/P&gt;&lt;P&gt;PROC PRINT DATA = orders NOOBS;&lt;/P&gt;&lt;P&gt;FORMAT OrderDate DATE7.;&lt;/P&gt;&lt;P&gt;TITLE "&amp;amp;SYSDAY Report: Current Orders";&lt;/P&gt;&lt;P&gt;%END;&lt;/P&gt;&lt;P&gt;%ELSE %IF &amp;amp;SYSDAY = WEDNESDAY %THEN %DO;&lt;/P&gt;&lt;P&gt;PROC TABULATE DATA = orders;&lt;/P&gt;&lt;P&gt;CLASS CustomerID;&lt;/P&gt;&lt;P&gt;VAR Quantity;&lt;/P&gt;&lt;P&gt;TABLE CustomerID ALL, Quantity;&lt;/P&gt;&lt;P&gt;TITLE "&amp;amp;SYSDAY Report: Summary of Orders";&lt;/P&gt;&lt;P&gt;%END;&lt;/P&gt;&lt;P&gt;%MEND reports;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;%reports&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;second code:&lt;/P&gt;&lt;P&gt;DATA orders;&lt;/P&gt;&lt;P&gt;INFILE 'C:\Users\Trajce\Contacts\Desktop\Orders.txt';&lt;/P&gt;&lt;P&gt;INPUT CustomerID $ 1-3 OrderDate DATE7. Model $ 13-24 Quantity;&lt;/P&gt;&lt;P&gt;IF &amp;amp;SYSDAY = Monday THEN DO;&lt;/P&gt;&lt;P&gt;PROC PRINT DATA = orders NOOBS;&lt;/P&gt;&lt;P&gt;FORMAT OrderDate DATE7.;&lt;/P&gt;&lt;P&gt;TITLE "&amp;amp;SYSDAY Report: Current Orders";&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;ELSE IF &amp;amp;SYSDAY = WEDNESDAY THEN DO;&lt;/P&gt;&lt;P&gt;PROC TABULATE DATA = orders;&lt;/P&gt;&lt;P&gt;CLASS CustomerID;&lt;/P&gt;&lt;P&gt;VAR Quantity;&lt;/P&gt;&lt;P&gt;TABLE CustomerID ALL, Quantity;&lt;/P&gt;&lt;P&gt;TITLE "&amp;amp;SYSDAY Report: Summary of Orders";&lt;/P&gt;&lt;P&gt;END;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 17:31:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126987#M294395</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2013-05-01T17:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126988#M294396</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS is case sensitive.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It should be Wednesday not WEDNESDAY.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 17:48:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126988#M294396</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-05-01T17:48:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126989#M294397</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it was actually Wednesday&amp;nbsp; and then changed to WEDNESDAY.Did not work in either way&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 17:51:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126989#M294397</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2013-05-01T17:51:08Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126990#M294398</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One issue could be that SYSDAY has the value the SAS session started. If you aren't closing and restarting SAS daily then you would have unexpected values.Second is to insure the proper case when comparing using equal signs. When I resolved SYSDAY on my system the result was Wednesday" not the WEDNESDAY used in your code. You may want to use %upcase(&amp;amp;sysday)=WEDNESDAY or use the case matching SYSDAY.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 17:53:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126990#M294398</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-05-01T17:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126991#M294399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;output &amp;amp;sysday and see what it says then.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 17:57:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126991#M294399</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-05-01T17:57:49Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126992#M294400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry Reeza.Dont know what you mean.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@Ballard&lt;/P&gt;&lt;P&gt;"If you aren't closing and restarting SAS daily then you would have unexpected values.Second is to insure the proper case when comparing using equal signs"&lt;/P&gt;&lt;P&gt;Is it recommended that i restart my SAS daily for Macros in order to work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 18:02:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126992#M294400</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2013-05-01T18:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126993#M294401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you running in EG or Base?&lt;/P&gt;&lt;P&gt;What does the log say when you run that line of code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; %put &amp;amp;sysday;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 18:06:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126993#M294401</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2013-05-01T18:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126994#M294402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok my SAS just resolved sysday to be Thursday and&amp;nbsp; when i changed to sysday=thursday i did get results.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could this&amp;nbsp; something to do&amp;nbsp; with my PC settings ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 18:09:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126994#M294402</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2013-05-01T18:09:14Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126995#M294403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;it is BASE and %put &amp;amp;sysday is giving me Thursday....Weird but thank you guys a lot &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 18:10:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126995#M294403</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2013-05-01T18:10:44Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126996#M294404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's reporting the date information from the computer system clock from when the SAS session started. If you're system date isn't Thursday but you started SAS and didn't shut it down since last week you could get Thursday. Try %put &amp;amp;sysdate as well. If the date isn't today you have another clue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 May 2013 22:00:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126996#M294404</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2013-05-01T22:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126997#M294405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one show me why Monday does not need to be in quote as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;%IF &amp;amp;SYSDAY = "Monday" %THEN %DO;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Thanks&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Dec 2014 06:34:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126997#M294405</guid>
      <dc:creator>Chang</dc:creator>
      <dc:date>2014-12-06T06:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126998#M294406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In the MACRO processor everything is strings. So if you are comparing a value quotes are not required, unless the value you want needs them.&lt;/P&gt;&lt;P&gt;This is one reason for using "&amp;amp;macrovariable" in data steps instead of having the macro variable include quotes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Dec 2014 15:40:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126998#M294406</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-12-08T15:40:53Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126999#M294407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can you please illustrate with examples? My understanding is that macro variables are always in quotes when used in the TITLE, FOOTNOTE statements. But when they are quoted in other statements, it becomes confusing. Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 13 Dec 2014 03:56:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/126999#M294407</guid>
      <dc:creator>Chang</dc:creator>
      <dc:date>2014-12-13T03:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Code</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/127000#M294408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In a title or other places you would use a text literal:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let val = Idaho;&lt;/P&gt;&lt;P&gt;Title " Report for &amp;amp;val"; which resolve to Title " Report for Idaho"; from the macro processor.&lt;/P&gt;&lt;P&gt;If you devine val as "Idaho" then one of two things are likely happen:&lt;/P&gt;&lt;P&gt;If you use&lt;/P&gt;&lt;P&gt;title 'Report for &amp;amp;val'; you don't resolve the macro variable because it is within single quotes.&lt;/P&gt;&lt;P&gt;If you use&lt;/P&gt;&lt;P&gt;title "Report for &amp;amp;val"; then the macro processor produces: Title "Report for "Idaho" "; and Idaho is OUTSIDE the quoted string required for title and isn't one of the acceptable options for title and will generate an error. There are ways to use the "value" definition but they get to be a lot of work, especially if you ever want to combine more than one macro variable in a statement.&lt;/P&gt;&lt;P&gt;In a data step:&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if state = "&amp;amp;val" then do; other code.&lt;/P&gt;&lt;P&gt;In this example you original approach would work. But This way you can tell immediately in the code that we are expecting a text literal (and you enhanced program editor will help with that).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But suppose I want the macro variable to reference a variable name:&lt;/P&gt;&lt;P&gt;%let var = Total_Sales;&lt;/P&gt;&lt;P&gt;Data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Someothervariable = &amp;amp;var * 1.05;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Dec 2014 19:02:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Code/m-p/127000#M294408</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-12-15T19:02:09Z</dc:date>
    </item>
  </channel>
</rss>

