<?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: Check format with date in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Check-format-with-date/m-p/134912#M27425</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the sql returns CAPITAL LETTERS - YYMMDDN8. therefore you need to compare the same things.&lt;/P&gt;&lt;P&gt;You have 2 options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) either change the macro -&amp;nbsp;&amp;nbsp; %if (%upcase(&amp;amp;comp) ^= &amp;amp;fLength) %then %do;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;2) call the macro with capital letters for the last variable&lt;/P&gt;&lt;P&gt;%check_format(&amp;amp;lib, &amp;amp;dsInOut, SMPLDATE, YYMMDDN8.);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Jan 2015 11:52:46 GMT</pubDate>
    <dc:creator>Loko</dc:creator>
    <dc:date>2015-01-23T11:52:46Z</dc:date>
    <item>
      <title>Check format with date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-format-with-date/m-p/134910#M27423</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've a big question.&lt;/P&gt;&lt;P&gt;I'm using SAS 9.3, I've a Macr that I use to check the formats of each variable in a dataset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is the Macro:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;%macro check_format(lib, ds, var, comp);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; proc sql noprint;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; select informat into: fLength&lt;/P&gt;
&lt;P&gt;&amp;nbsp; from dictionary.columns&lt;/P&gt;
&lt;P&gt;&amp;nbsp; where libname = upcase("&amp;amp;lib") and memname = upcase("&amp;amp;ds") and upcase(name) = upcase("&amp;amp;var");&lt;/P&gt;
&lt;P&gt;&amp;nbsp; quit;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %put This is fLength;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %put &amp;amp;fLength.;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %if (&amp;amp;comp ^= &amp;amp;fLength) %then %do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; data _null_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; put "ERROR: Format of &amp;amp;var is not = &amp;amp;comp, is &amp;amp;fLength ";&lt;/P&gt;
&lt;P&gt;&amp;nbsp; call symput('content_check_STOP','1');&lt;/P&gt;
&lt;P&gt;&amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; %end;&lt;/P&gt;
&lt;P&gt;%mend check_format;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I use this Macro with these paramenters doesn't work:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;%check_format(&amp;amp;lib, &amp;amp;dsInOut, SMPLDATE, yymmddn8.);&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;or:&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;%check_format(&amp;amp;lib, &amp;amp;dsInOut, SMPLTIME, tod5.);&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;but the dataset format is correct.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The error that i get is: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __jive_macro_name="quote" class="jive_text_macro jive_macro_quote"&gt;
&lt;P&gt;ERROR: Format of SMPLDATE is not = yymmddn8., is&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems that select informat returns ''.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help me? Thank you very much.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 11:25:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-format-with-date/m-p/134910#M27423</guid>
      <dc:creator>Lorenzom</dc:creator>
      <dc:date>2015-01-23T11:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Check format with date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-format-with-date/m-p/134911#M27424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You say "format is correct", but you are selecting &lt;EM&gt;in&lt;/EM&gt;format....?&lt;/P&gt;&lt;P&gt;Classic troubleshooting, best done by yourself.&lt;/P&gt;&lt;P&gt;Take the SQL, run it outside your macro, put the result in a table instead of macro variable etc...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 11:47:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-format-with-date/m-p/134911#M27424</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2015-01-23T11:47:04Z</dc:date>
    </item>
    <item>
      <title>Re: Check format with date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-format-with-date/m-p/134912#M27425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the sql returns CAPITAL LETTERS - YYMMDDN8. therefore you need to compare the same things.&lt;/P&gt;&lt;P&gt;You have 2 options:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) either change the macro -&amp;nbsp;&amp;nbsp; %if (%upcase(&amp;amp;comp) ^= &amp;amp;fLength) %then %do;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;2) call the macro with capital letters for the last variable&lt;/P&gt;&lt;P&gt;%check_format(&amp;amp;lib, &amp;amp;dsInOut, SMPLDATE, YYMMDDN8.);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 11:52:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-format-with-date/m-p/134912#M27425</guid>
      <dc:creator>Loko</dc:creator>
      <dc:date>2015-01-23T11:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: Check format with date</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-format-with-date/m-p/134913#M27426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With select format now works.... you are the best.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Jan 2015 13:35:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-format-with-date/m-p/134913#M27426</guid>
      <dc:creator>Lorenzom</dc:creator>
      <dc:date>2015-01-23T13:35:49Z</dc:date>
    </item>
  </channel>
</rss>

