<?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: variable for all date variables in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476548#M71226</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Since "date" variables are inferred based on their assigned SAS formats, you could also create a list of these (regardless of name) by &lt;A href="https://blogs.sas.com/content/iml/2017/03/20/sas-formats-fmtinfo.html" target="_self"&gt;examining the FMTINFO function&lt;/A&gt;, "Cat" attribute.&amp;nbsp; Some testing required &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let lib=SASHELP;
%let mem=AIR;

proc sql noprint;
 select t1.name into: dateVars separated by ' '
   from sashelp.vcolumn t1
   where libname="&amp;amp;lib." and memname="&amp;amp;mem"
   and fmtinfo(scan(t1.format,1),'Cat')="date"
 ;
quit;

%put &amp;amp;=dateVars;
proc report data=&amp;amp;lib..&amp;amp;mem.;
 columns _all_;
 define &amp;amp;datevars. / display style={TAGATTR='format:m/d/yyyy'};
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DEFINE statement is a bit eccentric about the difference between a "SAS Variable List" and a "list of SAS variables".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;81   proc report data=&amp;amp;lib..&amp;amp;mem.;
SYMBOLGEN:  Macro variable LIB resolves to SASHELP
SYMBOLGEN:  Macro variable MEM resolves to class
82    columns _all_;
83    define height weight / display style={TAGATTR='format:m/d/yyyy'};
                    ------
                    79
ERROR: HEIGHT does not have a numeric suffix.
ERROR 79-322: Expecting a -.
84   run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My SAS does not have SASHELP.AIR;&lt;/P&gt;</description>
    <pubDate>Mon, 09 Jul 2018 18:11:43 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2018-07-09T18:11:43Z</dc:date>
    <item>
      <title>variable for all date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476501#M71220</link>
      <description>&lt;P&gt;Is there a SAS created variable like _all_ or _numeric_ for date variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm automating reports and the following code&amp;nbsp;works but I was wondering if I could get more specific and say "format all date values as" instead of "format all numeric values as"&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;		proc report data=data;
		columns _all_;
		define _numeric_ /style={TAGATTR='format:m/d/yyyy'};
		run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 15:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476501#M71220</guid>
      <dc:creator>sfridy</dc:creator>
      <dc:date>2018-07-09T15:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: variable for all date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476502#M71221</link>
      <description>&lt;P&gt;Nope. Date variables are numbers/numeric.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a naming convention you can use the colon shortcut. Make all your date variables start with a common prefix such as:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Date_: &amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/158342"&gt;@sfridy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Is there a SAS created variable like _all_ or _numeric_ for date variables?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm automating reports and the following code&amp;nbsp;works but I was wondering if I could get more specific and say "format all date values as" instead of "format all numeric values as"&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;		proc report data=data;
		columns _all_;
		define _numeric_ /style={TAGATTR='format:m/d/yyyy'};
		run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 15:53:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476502#M71221</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-09T15:53:06Z</dc:date>
    </item>
    <item>
      <title>Re: variable for all date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476503#M71222</link>
      <description>&lt;P&gt;No. Dates are merely formatted integers. SAS doesn't know which numeric variables are interpreted as dates and which are not.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 15:54:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476503#M71222</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2018-07-09T15:54:08Z</dc:date>
    </item>
    <item>
      <title>Re: variable for all date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476506#M71223</link>
      <description>&lt;P&gt;What is the colon shortcut and how would it be implemented using proc report?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 16:06:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476506#M71223</guid>
      <dc:creator>sfridy</dc:creator>
      <dc:date>2018-07-09T16:06:49Z</dc:date>
    </item>
    <item>
      <title>Re: variable for all date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476508#M71224</link>
      <description>&lt;P&gt;&lt;A href="https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2018/05/29/6-easy-ways-to-specify-a-list-of-variables-in-sas.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It would like be (untested):&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Define date_: / format=..... ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This assumes all and only date variables start with DATE_.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/158342"&gt;@sfridy&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;What is the colon shortcut and how would it be implemented using proc report?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 16:17:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476508#M71224</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-07-09T16:17:36Z</dc:date>
    </item>
    <item>
      <title>Re: variable for all date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476523#M71225</link>
      <description>&lt;P&gt;Since "date" variables are inferred based on their assigned SAS formats, you could also create a list of these (regardless of name) by &lt;A href="https://blogs.sas.com/content/iml/2017/03/20/sas-formats-fmtinfo.html" target="_self"&gt;examining the FMTINFO function&lt;/A&gt;, "Cat" attribute.&amp;nbsp; Some testing required &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let lib=SASHELP;
%let mem=AIR;

proc sql noprint;
 select t1.name into: dateVars separated by ' '
   from sashelp.vcolumn t1
   where libname="&amp;amp;lib." and memname="&amp;amp;mem"
   and fmtinfo(scan(t1.format,1),'Cat')="date"
 ;
quit;

%put &amp;amp;=dateVars;
proc report data=&amp;amp;lib..&amp;amp;mem.;
 columns _all_;
 define &amp;amp;datevars. / display style={TAGATTR='format:m/d/yyyy'};
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Jul 2018 16:58:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476523#M71225</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2018-07-09T16:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: variable for all date variables</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476548#M71226</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4"&gt;@ChrisHemedinger&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Since "date" variables are inferred based on their assigned SAS formats, you could also create a list of these (regardless of name) by &lt;A href="https://blogs.sas.com/content/iml/2017/03/20/sas-formats-fmtinfo.html" target="_self"&gt;examining the FMTINFO function&lt;/A&gt;, "Cat" attribute.&amp;nbsp; Some testing required &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let lib=SASHELP;
%let mem=AIR;

proc sql noprint;
 select t1.name into: dateVars separated by ' '
   from sashelp.vcolumn t1
   where libname="&amp;amp;lib." and memname="&amp;amp;mem"
   and fmtinfo(scan(t1.format,1),'Cat')="date"
 ;
quit;

%put &amp;amp;=dateVars;
proc report data=&amp;amp;lib..&amp;amp;mem.;
 columns _all_;
 define &amp;amp;datevars. / display style={TAGATTR='format:m/d/yyyy'};
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The DEFINE statement is a bit eccentric about the difference between a "SAS Variable List" and a "list of SAS variables".&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;81   proc report data=&amp;amp;lib..&amp;amp;mem.;
SYMBOLGEN:  Macro variable LIB resolves to SASHELP
SYMBOLGEN:  Macro variable MEM resolves to class
82    columns _all_;
83    define height weight / display style={TAGATTR='format:m/d/yyyy'};
                    ------
                    79
ERROR: HEIGHT does not have a numeric suffix.
ERROR 79-322: Expecting a -.
84   run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My SAS does not have SASHELP.AIR;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jul 2018 18:11:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/variable-for-all-date-variables/m-p/476548#M71226</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2018-07-09T18:11:43Z</dc:date>
    </item>
  </channel>
</rss>

