<?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 SAS macro question &amp;quot;&amp;amp;sysday&amp;quot; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520605#M141201</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder may I ask the SAS macro question in terms of "%sysday" as I tested those options in SAS,&lt;/P&gt;&lt;P&gt;and except for the first one generating error, the other three seemed worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for reading and any advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro execute;
[ insert_statement_here_]
proc print data=sashelp.heart;
run;
%end;

%mend execute;
%execute&lt;/PRE&gt;&lt;P&gt;The question is:&lt;/P&gt;&lt;P&gt;Which statement completes the program so that the PROC PRINT step executes on Thursday?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;if &amp;amp;sysday = Thursday then %do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;B.&lt;/P&gt;&lt;P&gt;%if &amp;amp;sysday =Thursday %then %do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;C.&lt;/P&gt;&lt;P&gt;%if "&amp;amp;sysday"= Thursday %then %do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;D.&lt;/P&gt;&lt;P&gt;%if &amp;amp;sysday = "Thursday" %then %do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not really understand the differences among B,C, and D&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;</description>
    <pubDate>Tue, 11 Dec 2018 23:50:01 GMT</pubDate>
    <dc:creator>jc3992</dc:creator>
    <dc:date>2018-12-11T23:50:01Z</dc:date>
    <item>
      <title>SAS macro question "&amp;sysday"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520605#M141201</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder may I ask the SAS macro question in terms of "%sysday" as I tested those options in SAS,&lt;/P&gt;&lt;P&gt;and except for the first one generating error, the other three seemed worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much for reading and any advice.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;%macro execute;
[ insert_statement_here_]
proc print data=sashelp.heart;
run;
%end;

%mend execute;
%execute&lt;/PRE&gt;&lt;P&gt;The question is:&lt;/P&gt;&lt;P&gt;Which statement completes the program so that the PROC PRINT step executes on Thursday?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A.&amp;nbsp;&lt;/P&gt;&lt;P&gt;if &amp;amp;sysday = Thursday then %do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;B.&lt;/P&gt;&lt;P&gt;%if &amp;amp;sysday =Thursday %then %do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;C.&lt;/P&gt;&lt;P&gt;%if "&amp;amp;sysday"= Thursday %then %do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;D.&lt;/P&gt;&lt;P&gt;%if &amp;amp;sysday = "Thursday" %then %do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not really understand the differences among B,C, and D&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 23:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520605#M141201</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-12-11T23:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro question "&amp;sysday"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520608#M141204</link>
      <description>&lt;P&gt;Look at the quotation marks and &amp;amp; vs %, they're in different places.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't see the answer I'd expect&amp;nbsp;but I'm guessing that A and B don't match what's in the book. Can you please confirm A &amp;amp; B are posted correctly?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/188695"&gt;@jc3992&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder may I ask the SAS macro question in terms of "%sysday" as I tested those options in SAS,&lt;/P&gt;
&lt;P&gt;and except for the first one generating error, the other three seemed worked!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for reading and any advice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro execute;
[ insert_statement_here_]
proc print data=sashelp.heart;
run;
%end;

%mend execute;
%execute&lt;/PRE&gt;
&lt;P&gt;The question is:&lt;/P&gt;
&lt;P&gt;Which statement completes the program so that the PROC PRINT step executes on Thursday?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if %sysday = Thursday then %do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B.&lt;/P&gt;
&lt;P&gt;%if &lt;STRONG&gt;%&lt;/STRONG&gt;sysday =Thursday %then %do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;C.&lt;/P&gt;
&lt;P&gt;%if &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;&lt;STRONG&gt;&amp;amp;&lt;/STRONG&gt;sysday&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;= Thursday %then %do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;D.&lt;/P&gt;
&lt;P&gt;%if &amp;amp;sysday = &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt;Thursday&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/FONT&gt; %then %do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not really understand the differences among B,C, and D&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 22:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520608#M141204</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-11T22:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro question "&amp;sysday"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520611#M141205</link>
      <description>&lt;P&gt;1. It's &amp;amp;sysday, not %sysday.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;2.&amp;nbsp;&lt;/EM&gt;&lt;EM&gt;I do not really understand the differences among B,C, and D&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Then you are not looking carefully. Look at the quotes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;3. the other three seemed worked!&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I doubt C and D work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pay attention, these are not details.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 22:47:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520611#M141205</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-12-11T22:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro question "&amp;sysday"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520623#M141207</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/188695"&gt;@jc3992&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wonder may I ask the SAS macro question in terms of "%sysday" as I tested those options in SAS,&lt;/P&gt;
&lt;P&gt;and except for the first one generating error, the other three seemed worked!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much for reading and any advice.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%macro execute;
[ insert_statement_here_]
proc print data=sashelp.heart;
run;
%end;

%mend execute;
%execute&lt;/PRE&gt;
&lt;P&gt;The question is:&lt;/P&gt;
&lt;P&gt;Which statement completes the program so that the PROC PRINT step executes on Thursday?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;if %sysday = Thursday then %do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B.&lt;/P&gt;
&lt;P&gt;%if %sysday =Thursday %then %do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;C.&lt;/P&gt;
&lt;P&gt;%if "&amp;amp;sysday"= Thursday %then %do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;D.&lt;/P&gt;
&lt;P&gt;%if &amp;amp;sysday = "Thursday" %then %do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not really understand the differences among B,C, and D&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Actually since I would expect a semicolon after %do they are likely all wrong. Changing Thursday to Tuesday, since that is the day I tested this:&lt;/P&gt;
&lt;PRE&gt;621  %macro execute;
622  %if %sysday =Tuesday %then %do.
623  proc print data=sashelp.heart;
624  run;
625  %end;
&lt;FONT color="#ff0000"&gt;ERROR: There is no matching %DO statement for the %END. This statement will be ignored.
&lt;/FONT&gt;626
627  %mend execute;
NOTE: The macro EXECUTE completed compilation with errors.
&lt;/PRE&gt;
&lt;P&gt;Since none of the choices end in a semicolon all will generate the same no matching %do for the %end.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Spelling and punctuation do count in programming.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 23:37:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520623#M141207</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-12-11T23:37:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro question "&amp;sysday"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520627#M141211</link>
      <description>&lt;P&gt;Sorry I got a typo for the (A) and (B).&lt;/P&gt;&lt;P&gt;I have changed them to "&amp;amp;sysday".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just do not really understand when we should add a quote?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Tue, 11 Dec 2018 23:52:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520627#M141211</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-12-11T23:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro question "&amp;sysday"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520628#M141212</link>
      <description>Similar to basic math - both sides of the equal sign need to match. If you have quotes on one side you need them on the other.</description>
      <pubDate>Tue, 11 Dec 2018 23:55:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520628#M141212</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-11T23:55:03Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro question "&amp;sysday"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520632#M141214</link>
      <description>&lt;PRE&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         options mprint;
 74         
 75         %macro execute;
 76         %if "&amp;amp;sysday" = "Thursday" %then %do;
 77         proc print data=sashelp.heart;
 78         run;
 79         %end;
 80         
 81         %mend execute;
 82         %execute;
 83         
 84         
 85         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 98         &lt;/PRE&gt;&lt;P&gt;So if I add quote to the &amp;amp;sysday, I have to add the quote to the other side, like the above?&lt;/P&gt;&lt;P&gt;The log showed no error either.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 00:02:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520632#M141214</guid>
      <dc:creator>jc3992</dc:creator>
      <dc:date>2018-12-12T00:02:58Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macro question "&amp;sysday"</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520655#M141222</link>
      <description>&lt;P&gt;Test it. My system is showing sys day as Monday, so I'm using Monday in my tests.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;*check for trailing spaces, look where 000 ends up;
%put &amp;amp;sysday.000;

*check for quotes on both sides;
%if "&amp;amp;sysday."="Monday" %then %do;
    %put ERROR- Quotes on both sides;
%end;

*check for quotes on no sides;
%if &amp;amp;sysday=Monday %then %do;
    %put ERROR- No Quotes on either side;
%end;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;PRE&gt; 
 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 68         
 69         *check for trailing spaces, look where 000 ends up;
 70         %put &amp;amp;sysday.000;
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt; Monday000&lt;/STRONG&gt;&lt;/FONT&gt;
 71         
 72         *check for quotes on both sides;
 73         %if "&amp;amp;sysday."="Monday" %then %do;
 74             %put ERROR- Quotes on both sides;
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;        Quotes on both sides&lt;/STRONG&gt;&lt;/FONT&gt;
 75         %end;
 76         
 77         *check for quotes on no sides;
 78         %if &amp;amp;sysday=Monday %then %do;
 79             %put ERROR- No Quotes on either side;
&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;        No Quotes on either side&lt;/STRONG&gt;&lt;/FONT&gt;
 80         %end;
 81         
 82         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 93         &lt;/PRE&gt;
&lt;P&gt;Note that in SAS 9.4 TS1M5+ you can run %IF/%THEN in open code and do not need to wrap it a macro.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/188695"&gt;@jc3992&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 72         
 73         options mprint;
 74         
 75         %macro execute;
 76         %if "&amp;amp;sysday" = "Thursday" %then %do;
 77         proc print data=sashelp.heart;
 78         run;
 79         %end;
 80         
 81         %mend execute;
 82         %execute;
 83         
 84         
 85         OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 98         &lt;/PRE&gt;
&lt;P&gt;So if I add quote to the &amp;amp;sysday, I have to add the quote to the other side, like the above?&lt;/P&gt;
&lt;P&gt;The log showed no error either.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 02:18:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macro-question-quot-amp-sysday-quot/m-p/520655#M141222</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-12T02:18:38Z</dc:date>
    </item>
  </channel>
</rss>

