<?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: Identifying multiple date variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569645#M75214</link>
    <description>It is also useful &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;. But if I've date variable with the name created or modified or the formats also have a lot or the variables which don't have labels then everytime I need to check the data and create index functions....</description>
    <pubDate>Thu, 27 Jun 2019 21:14:10 GMT</pubDate>
    <dc:creator>Sivaram97</dc:creator>
    <dc:date>2019-06-27T21:14:10Z</dc:date>
    <item>
      <title>Identifying multiple date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569596#M75207</link>
      <description>Hi sas community,&lt;BR /&gt;I'm trying to find out that the count of all date variables in all datasets from a library. Is there any specific function or anything there for identifying date variables..?</description>
      <pubDate>Thu, 27 Jun 2019 19:19:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569596#M75207</guid>
      <dc:creator>Sivaram97</dc:creator>
      <dc:date>2019-06-27T19:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569597#M75208</link>
      <description>&lt;P&gt;Hi and welcome to the SAS Community &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you be a bit more specific? What do you mean by "&lt;SPAN&gt;count of all date variables"?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 19:23:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569597#M75208</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-06-27T19:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569599#M75209</link>
      <description>It means that I want to know how many date variables are present in each&lt;BR /&gt;sas dataset in a library&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Jun 2019 19:27:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569599#M75209</guid>
      <dc:creator>Sivaram97</dc:creator>
      <dc:date>2019-06-27T19:27:29Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569605#M75210</link>
      <description>&lt;P&gt;Use the FMTINFO() function to test if the variable has a format of DATE type associated with it.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want just DATE values or do you also want to look for DATETIME and TIME values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input id date time datetime amt comment $20.;
  informat date date. time time. datetime datetime. ;
  format date yymmdd10. time hhmm. datetime dtdate9.;
  format amt dollar10.2 ;
cards;
1 01jan2019 12:30 01JAN2019:12:30 1234.56 Example value
;

proc contents data=work._all_ out=cont noprint;
run;

data check;
 set cont;
 fmt_cat = fmtinfo(format,'cat');
run;

proc freq;
 where memname='TEST';
 tables fmt_cat;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;The FREQ Procedure

                                          Cumulative    Cumulative
fmt_cat          Frequency     Percent     Frequency      Percent
------------------------------------------------------------------
FMTNAME BLANK           2       33.33             2        33.33
curr                    1       16.67             3        50.00
date                    1       16.67             4        66.67
datetime                1       16.67             5        83.33
time                    1       16.67             6       100.00&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jun 2019 19:43:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569605#M75210</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-06-27T19:43:22Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569607#M75211</link>
      <description>&lt;P&gt;The answer by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;is a good one for variables that have been assigned a date or datetime or time format. Otherwise, it fails. You need to examine the data (and know what each field represents) in that case, I think there's a maxim about this.&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2019 19:47:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569607#M75211</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-06-27T19:47:01Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569610#M75212</link>
      <description>Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; it'll helps a lot</description>
      <pubDate>Thu, 27 Jun 2019 19:57:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569610#M75212</guid>
      <dc:creator>Sivaram97</dc:creator>
      <dc:date>2019-06-27T19:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569629#M75213</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/279664"&gt;@Sivaram97&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;It means that I want to know how many date variables are present in each&lt;BR /&gt;sas dataset in a library&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Have all of your "date" variables created as SAS date valued variables? Do all of them have appropriate date related formats?&lt;/P&gt;
&lt;P&gt;Do they have labels assigned that have the word date in them, or do the variables have date as part of their name?&lt;/P&gt;
&lt;P&gt;Then this may be possible by examining the name, format and/or label fields of the data sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However if you have character variables, or numeric variables that only look like a date such as 20190525 but is a simple numeric&amp;nbsp; without labels or names with "date" then those may be harder to find.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;An example that may get you started: Replace LIBRARY&amp;nbsp; with your library name in upper case as that is how they are stored in the meta data. I am also searching for a couple of the date formats but there are so many I only show a couple.&lt;/P&gt;
&lt;PRE&gt;proc sql;
   create table datevariables as
   select libname , memname, name,  label, format
   from dictionary.columns 
   where libname='LIBRARY' and 
         (
         (index(upcase(name),'DATE')&amp;gt;0)  or
         (index(upcase(label),'DATE')&amp;gt;0) or
         ( index(format, 'MMDDYY')&amp;gt;0) or
         ( index(format, 'DATE')&amp;gt;0)
         
        )
   ;
quit;&lt;/PRE&gt;</description>
      <pubDate>Thu, 27 Jun 2019 20:48:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569629#M75213</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-06-27T20:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Identifying multiple date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569645#M75214</link>
      <description>It is also useful &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw&lt;/a&gt;. But if I've date variable with the name created or modified or the formats also have a lot or the variables which don't have labels then everytime I need to check the data and create index functions....</description>
      <pubDate>Thu, 27 Jun 2019 21:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Identifying-multiple-date-variables/m-p/569645#M75214</guid>
      <dc:creator>Sivaram97</dc:creator>
      <dc:date>2019-06-27T21:14:10Z</dc:date>
    </item>
  </channel>
</rss>

