<?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: SAS - date column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/674385#M203078</link>
    <description>&lt;P&gt;This new version seems to work fine for me. Apparently you have to strip the numbers from the format. Look at the category variable to filter out all date/datetime variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you need to factor in the usage of custom user defined formats? If your variables do not have date formats then detecting date variables is a much more difficult issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
first = '01Jan2019'd; format first date9.;
second = dhms(first, 2, 24, 44);
format second datetime22.;
run;


proc contents data=demo;
run;


data FormatInfo;
length format $9. Type $12. Category $10. Desc $40. 
       DefW $5. MinW $5. MaxW $5. DefD $2. MinD $2. MaxD $2.; 

set sashelp.vcolumn;
where libname = 'WORK' and memname = 'DEMO';

format = compress(format, , 'ka');

Category = fmtinfo(format, "Cat");  /* numeric, character, date, ... */
Type = fmtinfo(format, "Type");     /* format, informat, or both */
Desc = fmtinfo(format, "Desc");     /* short description of the format */
DefW = fmtinfo(format, "DefW");     /* default width if you omit w. Example: BEST. */
MinW = fmtinfo(format, "MinW");     /* minimum width */
MaxW = fmtinfo(format, "MaxW");     /* maximum width */
DefD = fmtinfo(format, "DefD");     /* default decimal digits */
MinD = fmtinfo(format, "MinD");     /* minimum decimal digits */
MaxD = fmtinfo(format, "MaxD");     /* maximum decimal digits */
;
 
proc print data=FormatInfo noobs;
   var Name Format Type Category Desc;
run;


data one;   
   /*These do not work*/                                                                                                                            
   a=fmtinfo('date9','cat');
   b=fmtinfo('date9','type');
   c=fmtinfo('date9','desc');
   output;
   a=fmtinfo('datetime22','cat');
   b=fmtinfo('datetime22','type');
   c=fmtinfo('datetime22','desc');
   output;
   
   /*These do work*/
   a=fmtinfo('date','cat');
   b=fmtinfo('date','type');
   c=fmtinfo('date','desc');
   output;
   a=fmtinfo('datetime','cat');
   b=fmtinfo('datetime','type');
   c=fmtinfo('datetime','desc');
   output;

run; 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 04 Aug 2020 15:10:24 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2020-08-04T15:10:24Z</dc:date>
    <item>
      <title>SAS - date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/673466#M202606</link>
      <description>&lt;P&gt;I am trying to make a macro which will give all the columns having date value in any format.&lt;/P&gt;&lt;P&gt;Any suggestions or help will be much appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 15:31:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/673466#M202606</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2020-07-30T15:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: SAS - date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/673472#M202609</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data FormatInfo;
length Name $9. Type $8. Category $4. Desc $40. 
       DefW $5. MinW $5. MaxW $5. DefD $2. MinD $2. MaxD $2.; 

set sashelp.vcolumn;
where libname = 'SASHELP' and memname = 'CLASS';


Category = fmtinfo(Name, "Cat");  /* numeric, character, date, ... */
Type = fmtinfo(Name, "Type");     /* format, informat, or both */
Desc = fmtinfo(Name, "Desc");     /* short description of the format */
DefW = fmtinfo(Name, "DefW");     /* default width if you omit w. Example: BEST. */
MinW = fmtinfo(Name, "MinW");     /* minimum width */
MaxW = fmtinfo(Name, "MaxW");     /* maximum width */
DefD = fmtinfo(Name, "DefD");     /* default decimal digits */
MinD = fmtinfo(Name, "MinD");     /* minimum decimal digits */
MaxD = fmtinfo(Name, "MaxD");     /* maximum decimal digits */
;
 
proc print data=FormatInfo noobs;
   var Name Type Category Desc;
run;
 

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Something like that can get you the categories which you can then filter.&lt;/P&gt;
&lt;P&gt;To run it on your data set modify the WHERE statement to be the name of your data statements instead.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Jul 2020 15:40:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/673472#M202609</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-07-30T15:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS - date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/673517#M202630</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data FormatInfo;
length dataf $100.;
set sashelp.vcolumn;
where libname = 'SASHELP' and memtype='DATA';
dataf = coalescec(informat,format);
if (index(dataf,'YY') &amp;gt;0 or index(dataf,'MM')&amp;gt;0 or index(dataf,'DD')&amp;gt;0 or index(dataf,'DAT')&amp;gt;0 or index(dataf,'JUL')&amp;gt;0)
 and index(dataf,'COMMA') =0;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 30 Jul 2020 18:13:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/673517#M202630</guid>
      <dc:creator>smantha</dc:creator>
      <dc:date>2020-07-30T18:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS - date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/673686#M202712</link>
      <description>Hi Smantha,&lt;BR /&gt;Thanks for your response. i just wanted to comfirm What if we have check for All 12 month like "JUL" . Do we need to follow the same steps ?&lt;BR /&gt;</description>
      <pubDate>Fri, 31 Jul 2020 12:00:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/673686#M202712</guid>
      <dc:creator>Aexor</dc:creator>
      <dc:date>2020-07-31T12:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: SAS - date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/674385#M203078</link>
      <description>&lt;P&gt;This new version seems to work fine for me. Apparently you have to strip the numbers from the format. Look at the category variable to filter out all date/datetime variables.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you need to factor in the usage of custom user defined formats? If your variables do not have date formats then detecting date variables is a much more difficult issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data demo;
first = '01Jan2019'd; format first date9.;
second = dhms(first, 2, 24, 44);
format second datetime22.;
run;


proc contents data=demo;
run;


data FormatInfo;
length format $9. Type $12. Category $10. Desc $40. 
       DefW $5. MinW $5. MaxW $5. DefD $2. MinD $2. MaxD $2.; 

set sashelp.vcolumn;
where libname = 'WORK' and memname = 'DEMO';

format = compress(format, , 'ka');

Category = fmtinfo(format, "Cat");  /* numeric, character, date, ... */
Type = fmtinfo(format, "Type");     /* format, informat, or both */
Desc = fmtinfo(format, "Desc");     /* short description of the format */
DefW = fmtinfo(format, "DefW");     /* default width if you omit w. Example: BEST. */
MinW = fmtinfo(format, "MinW");     /* minimum width */
MaxW = fmtinfo(format, "MaxW");     /* maximum width */
DefD = fmtinfo(format, "DefD");     /* default decimal digits */
MinD = fmtinfo(format, "MinD");     /* minimum decimal digits */
MaxD = fmtinfo(format, "MaxD");     /* maximum decimal digits */
;
 
proc print data=FormatInfo noobs;
   var Name Format Type Category Desc;
run;


data one;   
   /*These do not work*/                                                                                                                            
   a=fmtinfo('date9','cat');
   b=fmtinfo('date9','type');
   c=fmtinfo('date9','desc');
   output;
   a=fmtinfo('datetime22','cat');
   b=fmtinfo('datetime22','type');
   c=fmtinfo('datetime22','desc');
   output;
   
   /*These do work*/
   a=fmtinfo('date','cat');
   b=fmtinfo('date','type');
   c=fmtinfo('date','desc');
   output;
   a=fmtinfo('datetime','cat');
   b=fmtinfo('datetime','type');
   c=fmtinfo('datetime','desc');
   output;

run; 
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Aug 2020 15:10:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/674385#M203078</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2020-08-04T15:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS - date column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/674643#M203164</link>
      <description>&lt;P&gt;"JUL" is not related to the month July, but to the formats for Julian-calendars, like &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=leforinforref&amp;amp;docsetTarget=p0rzo1ok9zk0x4n1oz50uf9a5jle.htm&amp;amp;locale=en" target="_self"&gt;JULDAYw.&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Aug 2020 04:30:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-date-column/m-p/674643#M203164</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2020-08-05T04:30:38Z</dc:date>
    </item>
  </channel>
</rss>

