<?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: Count of Observation as Filename in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/m-p/852100#M37434</link>
    <description>&lt;P&gt;For any further automation, adding such a number to a filename will be an obstacle. Don't do it.&lt;/P&gt;
&lt;P&gt;If people need that value, create a separate report and publish that (e.g. as HTML page via the SAS server's web server).&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jan 2023 10:35:39 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-01-04T10:35:39Z</dc:date>
    <item>
      <title>Count of Observation as Filename</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/m-p/852084#M37429</link>
      <description>&lt;P&gt;I was working on SAS and I came to know that we can name our files as today's date using a pre-defined macro. But now I want to name my file as count of observations with file name and todays date. For Example: there were 3445 total observations and I want to keep my filename as Work with todays date.&lt;/P&gt;&lt;P&gt;So, the file name should be = 2023/01/04Work(Total Count = 3445).&lt;/P&gt;&lt;P&gt;The code in which filename was today's date is as follows so that you all can understand what I want. I want the exported file to be named as explained above.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;proc export data=ABCData
outfile="/fileextension/Work\%sysfunc( today(), DDmmYY7 ).csv"
REPLACE
DBMS=CSV;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Please, Help I want to learn how can I do that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 04:53:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/m-p/852084#M37429</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2023-01-04T04:53:16Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Observation as Filename</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/m-p/852086#M37431</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/437885"&gt;@Kirito1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I was working on SAS and I came to know that we can name our files as today's date using a pre-defined macro. But now I want to name my file as count of observations with file name and todays date. For Example: there were 3445 total observations and I want to keep my filename as Work with todays date.&lt;/P&gt;
&lt;P&gt;So, the file name should be = 2023/01/04Work(Total Count = 3445).&lt;/P&gt;
&lt;P&gt;The code in which filename was today's date is as follows so that you all can understand what I want. I want the exported file to be named as explained above.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Stick for your filenames to letters, digits and the underscore. Using any other character is just asking for trouble with either SAS, your operating system or both.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below some code illustrating how this could be done.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  call symputx('rowcnt',nobs);
  stop;
  set sashelp.class nobs=nobs;
run;

proc export
  data=sashelp.class
  outfile="c:\temp\myfile_&amp;amp;rowcnt._%sysfunc(today(),yymmddn8).csv"
  replace
  dbms=csv;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 05:45:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/m-p/852086#M37431</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-01-04T05:45:12Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Observation as Filename</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/m-p/852087#M37432</link>
      <description>I want to automate the process of naming file without even specifying date and row count its like a summary for the file before even opening a file. Its not useless If you think about it.</description>
      <pubDate>Wed, 04 Jan 2023 05:50:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/m-p/852087#M37432</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2023-01-04T05:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Observation as Filename</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/m-p/852090#M37433</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/437885"&gt;@Kirito1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I want to automate the process of naming file without even specifying date and row count its like a summary for the file before even opening a file. Its not useless If you think about it.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Then what I've posted will work if the source table is a SAS table. If the source table is a database table then you will need to actually count the rows with code as below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
  select count(*) format=f16. into :rowcnt trimmed
  from sashelp.class;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Jan 2023 08:24:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/m-p/852090#M37433</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-01-04T08:24:59Z</dc:date>
    </item>
    <item>
      <title>Re: Count of Observation as Filename</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/m-p/852100#M37434</link>
      <description>&lt;P&gt;For any further automation, adding such a number to a filename will be an obstacle. Don't do it.&lt;/P&gt;
&lt;P&gt;If people need that value, create a separate report and publish that (e.g. as HTML page via the SAS server's web server).&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jan 2023 10:35:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/m-p/852100#M37434</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-01-04T10:35:39Z</dc:date>
    </item>
  </channel>
</rss>

