<?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: Explain the following code; in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Explain-the-following-code/m-p/677676#M204441</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/251573"&gt;@mahossain&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;%macro birth (BRTHDTC=,BRTHDT=);&lt;BR /&gt;if length(&amp;amp;BRTHDTC)=10 then &amp;amp;BRTHDTC._=&amp;amp;BRTHDTC;&lt;BR /&gt;else if length(&amp;amp;BRTHDTC)=7 then &amp;amp;BRTHDTC._=strip(&amp;amp;BRTHDTC)||'-15';&lt;BR /&gt;else if length(&amp;amp;BRTHDTC)=4 then &amp;amp;BRTHDTC._=strip(&amp;amp;BRTHDTC)||'-07-01';&lt;BR /&gt;else &amp;amp;BRTHDTC._='';&lt;BR /&gt;&amp;amp;BRTHDT=input(&amp;amp;BRTHDTC._,yymmdd10.);&lt;BR /&gt;format &amp;amp;BRTHDT date9.;&lt;BR /&gt;drop &amp;amp;BRTHDTC._;&lt;BR /&gt;%mend birth;&lt;/P&gt;
&lt;P&gt;Q1: Can i the length with if statement without macro?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Q2: why did we use &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;BRTHDTC_;&lt;/STRONG&gt; &lt;/FONT&gt;what does it mean variable with underscore&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Very definitely BRTHDTC_ &lt;STRONG&gt;was not used in the code. &lt;/STRONG&gt;The dot in &amp;amp;BRTHDTC&lt;FONT size="5" color="#008000"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/FONT&gt;_ is used by the macro language to indicate concatenation of a macro variable resolved value, what ever &amp;amp;BRTHDTC might be and then append an _ character.&lt;/P&gt;
&lt;P&gt;If the program had &amp;amp;BRTHDTC_ then with a probability approaching unity you would get an error with an undefined macro variable by that name.&lt;/P&gt;</description>
    <pubDate>Wed, 19 Aug 2020 02:11:32 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2020-08-19T02:11:32Z</dc:date>
    <item>
      <title>Explain the following code;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explain-the-following-code/m-p/677565#M204395</link>
      <description>&lt;P&gt;%macro birth (BRTHDTC=,BRTHDT=);&lt;BR /&gt;if length(&amp;amp;BRTHDTC)=10 then &amp;amp;BRTHDTC._=&amp;amp;BRTHDTC;&lt;BR /&gt;else if length(&amp;amp;BRTHDTC)=7 then &amp;amp;BRTHDTC._=strip(&amp;amp;BRTHDTC)||'-15';&lt;BR /&gt;else if length(&amp;amp;BRTHDTC)=4 then &amp;amp;BRTHDTC._=strip(&amp;amp;BRTHDTC)||'-07-01';&lt;BR /&gt;else &amp;amp;BRTHDTC._='';&lt;BR /&gt;&amp;amp;BRTHDT=input(&amp;amp;BRTHDTC._,yymmdd10.);&lt;BR /&gt;format &amp;amp;BRTHDT date9.;&lt;BR /&gt;drop &amp;amp;BRTHDTC._;&lt;BR /&gt;%mend birth;&lt;/P&gt;&lt;P&gt;Q1: Can i the length with if statement without macro?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Q2: why did we use BRTHDTC_; what does it mean variable with underscore&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 17:35:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explain-the-following-code/m-p/677565#M204395</guid>
      <dc:creator>mahossain</dc:creator>
      <dc:date>2020-08-18T17:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Explain the following code;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explain-the-following-code/m-p/677582#M204403</link>
      <description>&lt;P&gt;The posted macro generates a code &lt;STRONG&gt;to be part of some program&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;The arguments supplied are probably names of variables used in that program;&lt;/P&gt;
&lt;P&gt;The variable &amp;amp;&lt;SPAN&gt;BRTHDTC holds probably a value of a date.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;The date may be in&amp;nbsp; &amp;nbsp;&lt;STRONG&gt;yy-mm-dd&lt;/STRONG&gt;&amp;nbsp; format and a length of 10, or&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;it may be in a format of &lt;STRONG&gt;yyyy-mm&lt;/STRONG&gt; and a length of 7, or jusy&amp;nbsp;&lt;STRONG&gt;yyyy&lt;/STRONG&gt; and length is 4.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro code creates a new (maybe temporary) date named &amp;amp;&lt;SPAN&gt;BRTHDTC._&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;(example, if&amp;nbsp;&amp;amp;BRTHDTC = DTX then&amp;nbsp;&amp;amp;BRTHDTC._ = DTX_ );&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Remember that undersore&amp;nbsp; ('_') can be anywhere in a variable name.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Aug 2020 18:19:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explain-the-following-code/m-p/677582#M204403</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-08-18T18:19:24Z</dc:date>
    </item>
    <item>
      <title>Re: Explain the following code;</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Explain-the-following-code/m-p/677676#M204441</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/251573"&gt;@mahossain&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;%macro birth (BRTHDTC=,BRTHDT=);&lt;BR /&gt;if length(&amp;amp;BRTHDTC)=10 then &amp;amp;BRTHDTC._=&amp;amp;BRTHDTC;&lt;BR /&gt;else if length(&amp;amp;BRTHDTC)=7 then &amp;amp;BRTHDTC._=strip(&amp;amp;BRTHDTC)||'-15';&lt;BR /&gt;else if length(&amp;amp;BRTHDTC)=4 then &amp;amp;BRTHDTC._=strip(&amp;amp;BRTHDTC)||'-07-01';&lt;BR /&gt;else &amp;amp;BRTHDTC._='';&lt;BR /&gt;&amp;amp;BRTHDT=input(&amp;amp;BRTHDTC._,yymmdd10.);&lt;BR /&gt;format &amp;amp;BRTHDT date9.;&lt;BR /&gt;drop &amp;amp;BRTHDTC._;&lt;BR /&gt;%mend birth;&lt;/P&gt;
&lt;P&gt;Q1: Can i the length with if statement without macro?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Q2: why did we use &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;BRTHDTC_;&lt;/STRONG&gt; &lt;/FONT&gt;what does it mean variable with underscore&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Very definitely BRTHDTC_ &lt;STRONG&gt;was not used in the code. &lt;/STRONG&gt;The dot in &amp;amp;BRTHDTC&lt;FONT size="5" color="#008000"&gt;&lt;STRONG&gt;.&lt;/STRONG&gt;&lt;/FONT&gt;_ is used by the macro language to indicate concatenation of a macro variable resolved value, what ever &amp;amp;BRTHDTC might be and then append an _ character.&lt;/P&gt;
&lt;P&gt;If the program had &amp;amp;BRTHDTC_ then with a probability approaching unity you would get an error with an undefined macro variable by that name.&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2020 02:11:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Explain-the-following-code/m-p/677676#M204441</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-08-19T02:11:32Z</dc:date>
    </item>
  </channel>
</rss>

