<?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 Macro Variable time in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-time/m-p/337021#M76466</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have three macro variables A, B&lt;/P&gt;&lt;P&gt;A is DATE9.&lt;/P&gt;&lt;P&gt;B is TIME8.&lt;/P&gt;&lt;P&gt;C is TIME8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table Z with several columns including:&lt;/P&gt;&lt;P&gt;D which is DATE9,&lt;/P&gt;&lt;P&gt;E which is TIME8.&lt;/P&gt;&lt;P&gt;F which is TIME8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to fill in F&amp;nbsp;whith C only for rows where A=D and B=E&lt;/P&gt;&lt;P&gt;I do this:&lt;/P&gt;&lt;PRE&gt;data Z;
set Z;
			
if F = . AND D = "&amp;amp;A."d AND E = "&amp;amp;B."t then do;
F = "&amp;amp;C."t;
end;
run;&lt;/PRE&gt;&lt;P&gt;Quite easy but doesn't work...&lt;/P&gt;&lt;P&gt;It seems the problem comes from:&lt;/P&gt;&lt;PRE&gt;AND E = "&amp;amp;B."t&lt;/PRE&gt;&lt;P&gt;Because When I do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data Z;
set Z;
			
if F = . AND D = "&amp;amp;A."d &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;/*AND E = "&amp;amp;B."t*/&lt;/STRONG&gt;&lt;/FONT&gt; then do;
F = "&amp;amp;C."t;
end;
run;&lt;/PRE&gt;&lt;P&gt;...it works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My macro variables B is correct because when I do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data Z;
set Z;
			
if F = . AND D = "&amp;amp;A."d &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;/*AND E = "&amp;amp;B."t*/&lt;/STRONG&gt;&lt;/FONT&gt; then do;
&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;F = "&amp;amp;B."t&lt;/FONT&gt;;&lt;/STRONG&gt;
end;
run;&lt;/PRE&gt;&lt;P&gt;it works too!&lt;/P&gt;&lt;P&gt;&amp;nbsp;Do you know why?&lt;/P&gt;</description>
    <pubDate>Wed, 01 Mar 2017 15:38:25 GMT</pubDate>
    <dc:creator>Planck</dc:creator>
    <dc:date>2017-03-01T15:38:25Z</dc:date>
    <item>
      <title>Macro Variable time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-time/m-p/337021#M76466</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have three macro variables A, B&lt;/P&gt;&lt;P&gt;A is DATE9.&lt;/P&gt;&lt;P&gt;B is TIME8.&lt;/P&gt;&lt;P&gt;C is TIME8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a table Z with several columns including:&lt;/P&gt;&lt;P&gt;D which is DATE9,&lt;/P&gt;&lt;P&gt;E which is TIME8.&lt;/P&gt;&lt;P&gt;F which is TIME8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to fill in F&amp;nbsp;whith C only for rows where A=D and B=E&lt;/P&gt;&lt;P&gt;I do this:&lt;/P&gt;&lt;PRE&gt;data Z;
set Z;
			
if F = . AND D = "&amp;amp;A."d AND E = "&amp;amp;B."t then do;
F = "&amp;amp;C."t;
end;
run;&lt;/PRE&gt;&lt;P&gt;Quite easy but doesn't work...&lt;/P&gt;&lt;P&gt;It seems the problem comes from:&lt;/P&gt;&lt;PRE&gt;AND E = "&amp;amp;B."t&lt;/PRE&gt;&lt;P&gt;Because When I do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data Z;
set Z;
			
if F = . AND D = "&amp;amp;A."d &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;/*AND E = "&amp;amp;B."t*/&lt;/STRONG&gt;&lt;/FONT&gt; then do;
F = "&amp;amp;C."t;
end;
run;&lt;/PRE&gt;&lt;P&gt;...it works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My macro variables B is correct because when I do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data Z;
set Z;
			
if F = . AND D = "&amp;amp;A."d &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;/*AND E = "&amp;amp;B."t*/&lt;/STRONG&gt;&lt;/FONT&gt; then do;
&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;F = "&amp;amp;B."t&lt;/FONT&gt;;&lt;/STRONG&gt;
end;
run;&lt;/PRE&gt;&lt;P&gt;it works too!&lt;/P&gt;&lt;P&gt;&amp;nbsp;Do you know why?&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:38:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-time/m-p/337021#M76466</guid>
      <dc:creator>Planck</dc:creator>
      <dc:date>2017-03-01T15:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Variable time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-time/m-p/337024#M76467</link>
      <description>&lt;P&gt;I edited my message. The good version is the one I just posted&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-time/m-p/337024#M76467</guid>
      <dc:creator>Planck</dc:creator>
      <dc:date>2017-03-01T15:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Variable time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-time/m-p/337025#M76468</link>
      <description>&lt;P&gt;What "doesn't work"? &amp;nbsp;Post an example showing the %let's and some simple test data which illustrate your points. &amp;nbsp;Also check by putting on:&lt;/P&gt;
&lt;P&gt;options mlogic mprint sybolgen;&lt;/P&gt;
&lt;P&gt;To see exactly what is happening.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also note that macro variables are not a good storage medium for data. &amp;nbsp;You would find your programming simpler if you put your data into a dataset, then merge that information onto your other data. &amp;nbsp;This will make coding simpler and you can use actual date/time variables.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:41:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-time/m-p/337025#M76468</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-03-01T15:41:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Variable time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-time/m-p/337026#M76469</link>
      <description>&lt;P&gt;Your code seems fine. The issue is likely in the values of the macro variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A good way to start troubleshooting macro issues is to set the proper options:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Execute&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options mprint symbolgen mlogic;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and rerun your code. Observe the log and see where that gets you. And please add the log of your code and some sample of your data. You say it doesn't work but it is inclear in which way it doesn't. Help us help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;- Jan.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:41:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-time/m-p/337026#M76469</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2017-03-01T15:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Macro Variable time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-time/m-p/337030#M76472</link>
      <description>Haha mid-air collision with my almost identical response &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;</description>
      <pubDate>Wed, 01 Mar 2017 15:43:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-Variable-time/m-p/337030#M76472</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2017-03-01T15:43:08Z</dc:date>
    </item>
  </channel>
</rss>

