<?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: Formatting Variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Formatting-Variables/m-p/68813#M14932</link>
    <description>It depends on how you can identify the variables that need to be "reformatted".&lt;BR /&gt;
&lt;BR /&gt;
If they have names that begin with DT then you can write&lt;BR /&gt;
&lt;BR /&gt;
[pre]format DT: mmddyy10.;[/pre]&lt;BR /&gt;
&lt;BR /&gt;
or you might use SQL and create a list of names base on current format and change the format that way.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sql;&lt;BR /&gt;
   select name into :datevars separated by ' '&lt;BR /&gt;
   from dictionary.columns&lt;BR /&gt;
   where libname et '....' and memname eq '....' and format eqt 'date';&lt;BR /&gt;
   quit;&lt;BR /&gt;
&lt;BR /&gt;
....&lt;BR /&gt;
format &amp;amp;datevar mmddyy10.;&lt;BR /&gt;
....&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
You will need to lookup the details with regards to dictionary.columns</description>
    <pubDate>Tue, 16 Mar 2010 17:25:17 GMT</pubDate>
    <dc:creator>data_null__</dc:creator>
    <dc:date>2010-03-16T17:25:17Z</dc:date>
    <item>
      <title>Formatting Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-Variables/m-p/68812#M14931</link>
      <description>I have a simple data step to export a data set to a text file.&lt;BR /&gt;
&lt;BR /&gt;
DATA _NULL_ ;&lt;BR /&gt;
FILE "filename" DSD DLM='~' ;&lt;BR /&gt;
SET table;&lt;BR /&gt;
PUT (_ALL_)(:) ;&lt;BR /&gt;
RUN;&lt;BR /&gt;
&lt;BR /&gt;
However, I need to change the format of all date variables.  Is there any way to do this other than formatting each variable?  I have a hundred or so tables, each with many date variables.&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Chris</description>
      <pubDate>Tue, 16 Mar 2010 17:02:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-Variables/m-p/68812#M14931</guid>
      <dc:creator>cjohnson</dc:creator>
      <dc:date>2010-03-16T17:02:28Z</dc:date>
    </item>
    <item>
      <title>Re: Formatting Variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Formatting-Variables/m-p/68813#M14932</link>
      <description>It depends on how you can identify the variables that need to be "reformatted".&lt;BR /&gt;
&lt;BR /&gt;
If they have names that begin with DT then you can write&lt;BR /&gt;
&lt;BR /&gt;
[pre]format DT: mmddyy10.;[/pre]&lt;BR /&gt;
&lt;BR /&gt;
or you might use SQL and create a list of names base on current format and change the format that way.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc sql;&lt;BR /&gt;
   select name into :datevars separated by ' '&lt;BR /&gt;
   from dictionary.columns&lt;BR /&gt;
   where libname et '....' and memname eq '....' and format eqt 'date';&lt;BR /&gt;
   quit;&lt;BR /&gt;
&lt;BR /&gt;
....&lt;BR /&gt;
format &amp;amp;datevar mmddyy10.;&lt;BR /&gt;
....&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
You will need to lookup the details with regards to dictionary.columns</description>
      <pubDate>Tue, 16 Mar 2010 17:25:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Formatting-Variables/m-p/68813#M14932</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-03-16T17:25:17Z</dc:date>
    </item>
  </channel>
</rss>

