<?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 Output file name with date from a data set in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Output-file-name-with-date-from-a-data-set/m-p/572470#M12327</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I'm trying to change the name of my outfile....&lt;/P&gt;&lt;P&gt;Currently I'm using today's date to stamp the date at the end of my file name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let numdate = %sysfunc(today(), MONYY7.);&lt;BR /&gt;proc export data=WORK.FORMAT_FIELDS&lt;BR /&gt;outfile="Z:\Commercial Operations\TRANSITION\test\TERR_TRX_SENSORS&amp;amp;numdate..txt"&lt;BR /&gt;dbms=dlm&lt;BR /&gt;replace;&lt;BR /&gt;delimiter='|';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;So what I'm getting for my file name is TERR_TRX_SENSORSJULY2019.&lt;/P&gt;&lt;P&gt;This works great, however what I would like to do is instead of using today's date, I would like to use a date within my data set.&lt;/P&gt;&lt;P&gt;For example, In my WORK.FORMAT_FIELDS table, I have a field called CAL_MTH_DT.&amp;nbsp; The CAL_MTH_DT is 5/31/2019, so I would like it to be something like:&lt;/P&gt;&lt;P&gt;%let numdate = %sysfunc(&lt;STRONG&gt;CAL_MTH_DT&lt;/STRONG&gt;, MONYY7.);&lt;BR /&gt;proc export data=WORK.FORMAT_FIELDS&lt;BR /&gt;outfile="Z:\Commercial Operations\TRANSITION\test\TERR_TRX_SENSORS&amp;amp;numdate..txt"&lt;BR /&gt;dbms=dlm&lt;BR /&gt;replace;&lt;BR /&gt;delimiter='|';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;That way my file name comes out as TERR_TRX_SENSORSMAY2019.&lt;/P&gt;&lt;P&gt;But this is working and I'm trying to figure out how to make the date the date from my data set if possible.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jul 2019 18:24:01 GMT</pubDate>
    <dc:creator>LRogers</dc:creator>
    <dc:date>2019-07-10T18:24:01Z</dc:date>
    <item>
      <title>Output file name with date from a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-file-name-with-date-from-a-data-set/m-p/572470#M12327</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;I'm trying to change the name of my outfile....&lt;/P&gt;&lt;P&gt;Currently I'm using today's date to stamp the date at the end of my file name.&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let numdate = %sysfunc(today(), MONYY7.);&lt;BR /&gt;proc export data=WORK.FORMAT_FIELDS&lt;BR /&gt;outfile="Z:\Commercial Operations\TRANSITION\test\TERR_TRX_SENSORS&amp;amp;numdate..txt"&lt;BR /&gt;dbms=dlm&lt;BR /&gt;replace;&lt;BR /&gt;delimiter='|';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;So what I'm getting for my file name is TERR_TRX_SENSORSJULY2019.&lt;/P&gt;&lt;P&gt;This works great, however what I would like to do is instead of using today's date, I would like to use a date within my data set.&lt;/P&gt;&lt;P&gt;For example, In my WORK.FORMAT_FIELDS table, I have a field called CAL_MTH_DT.&amp;nbsp; The CAL_MTH_DT is 5/31/2019, so I would like it to be something like:&lt;/P&gt;&lt;P&gt;%let numdate = %sysfunc(&lt;STRONG&gt;CAL_MTH_DT&lt;/STRONG&gt;, MONYY7.);&lt;BR /&gt;proc export data=WORK.FORMAT_FIELDS&lt;BR /&gt;outfile="Z:\Commercial Operations\TRANSITION\test\TERR_TRX_SENSORS&amp;amp;numdate..txt"&lt;BR /&gt;dbms=dlm&lt;BR /&gt;replace;&lt;BR /&gt;delimiter='|';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;That way my file name comes out as TERR_TRX_SENSORSMAY2019.&lt;/P&gt;&lt;P&gt;But this is working and I'm trying to figure out how to make the date the date from my data set if possible.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 18:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-file-name-with-date-from-a-data-set/m-p/572470#M12327</guid>
      <dc:creator>LRogers</dc:creator>
      <dc:date>2019-07-10T18:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: Output file name with date from a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-file-name-with-date-from-a-data-set/m-p/572474#M12328</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set work.format_fields (obs=1);
call symput('ts',put(cal_mth_dt,yymmn6.));
run;

proc export
  data=work.format_fields
  outfile="Z:\Commercial Operations\TRANSITION\test\TERR_TRX_SENSORS&amp;amp;ts..txt"
  dbms=dlm
  replace
;
delimiter='|';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Jul 2019 18:36:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-file-name-with-date-from-a-data-set/m-p/572474#M12328</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-07-10T18:36:21Z</dc:date>
    </item>
    <item>
      <title>Re: Output file name with date from a data set</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Output-file-name-with-date-from-a-data-set/m-p/572478#M12329</link>
      <description>&lt;P&gt;Thank you so much, Kurt!&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This worked great!!!!&amp;nbsp; Great learning for me!&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jul 2019 18:59:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Output-file-name-with-date-from-a-data-set/m-p/572478#M12329</guid>
      <dc:creator>LRogers</dc:creator>
      <dc:date>2019-07-10T18:59:10Z</dc:date>
    </item>
  </channel>
</rss>

