<?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: NUMBER OF TRANSACTION AS FILE NAME in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/NUMBER-OF-TRANSACTION-AS-FILE-NAME/m-p/860144#M37993</link>
    <description>&lt;P&gt;You can extract no records in your input data set using dictionary.tables:&lt;/P&gt;
&lt;P&gt;Untested:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   select nobs into: nrecs
      from dictionary.tabeles
      where memname = "CUSTAVG"
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Feb 2023 12:24:33 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2023-02-22T12:24:33Z</dc:date>
    <item>
      <title>NUMBER OF TRANSACTION AS FILE NAME</title>
      <link>https://communities.sas.com/t5/New-SAS-User/NUMBER-OF-TRANSACTION-AS-FILE-NAME/m-p/860137#M37991</link>
      <description>&lt;P&gt;I was working on SAS I wanted to name file something like below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data=CUSTAVG
outfile="/Outfile_file/Transactions \%sysfunc( today(), date9 ).csv"
REPLACE
DBMS=CSV;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But now I want number of records in the files, with file name.&lt;/P&gt;
&lt;P&gt;For Example my file name is transaction that has 55 records and I want yesterdays date to be attached with filename.&lt;/P&gt;
&lt;P&gt;Something like this : Transactions 21FEB2023 (55)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can anyone help, How can I do that in this existing code. I know some macro should be build.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 12:03:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/NUMBER-OF-TRANSACTION-AS-FILE-NAME/m-p/860137#M37991</guid>
      <dc:creator>Kirito1</dc:creator>
      <dc:date>2023-02-22T12:03:46Z</dc:date>
    </item>
    <item>
      <title>Re: NUMBER OF TRANSACTION AS FILE NAME</title>
      <link>https://communities.sas.com/t5/New-SAS-User/NUMBER-OF-TRANSACTION-AS-FILE-NAME/m-p/860143#M37992</link>
      <description>&lt;P&gt;Adding the number of transactions into a file name just makes the file more difficult to find, and in my opinion, the best thing to do would be to leave the number of transactions out of the file name. What is the benefit of adding it in?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You asked the same question in your &lt;A href="https://communities.sas.com/t5/New-SAS-User/Count-of-Observation-as-Filename/td-p/852084" target="_self"&gt;earlier thread&lt;/A&gt;, and so by asking again, you get the same advice.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 13:19:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/NUMBER-OF-TRANSACTION-AS-FILE-NAME/m-p/860143#M37992</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-02-22T13:19:54Z</dc:date>
    </item>
    <item>
      <title>Re: NUMBER OF TRANSACTION AS FILE NAME</title>
      <link>https://communities.sas.com/t5/New-SAS-User/NUMBER-OF-TRANSACTION-AS-FILE-NAME/m-p/860144#M37993</link>
      <description>&lt;P&gt;You can extract no records in your input data set using dictionary.tables:&lt;/P&gt;
&lt;P&gt;Untested:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
   select nobs into: nrecs
      from dictionary.tabeles
      where memname = "CUSTAVG"
   ;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 12:24:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/NUMBER-OF-TRANSACTION-AS-FILE-NAME/m-p/860144#M37993</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2023-02-22T12:24:33Z</dc:date>
    </item>
    <item>
      <title>Re: NUMBER OF TRANSACTION AS FILE NAME</title>
      <link>https://communities.sas.com/t5/New-SAS-User/NUMBER-OF-TRANSACTION-AS-FILE-NAME/m-p/860149#M37994</link>
      <description>&lt;P&gt;Three suggestions:&lt;/P&gt;
&lt;P&gt;Use a date in the form of YYYYMMDD. That way system sorting tools will show the sets in calendar date order.&lt;/P&gt;
&lt;P&gt;Second, do not use special characters like () in file names.&lt;/P&gt;
&lt;P&gt;Third, always start an output file name/path with the drive (windows) or root of a mount point for a drive.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One way to may a suggested file&lt;/P&gt;
&lt;PRE&gt;data _null_;
   set CUSTAVG (obs=1) nobs=c;
   call symputx('trans_n',c);
   call symputx('yesterday',put(intnx('day',today(),-1),yymmddn8.));
run;


proc export data=CUSTAVG
outfile="/Outfile_file/Transactions&amp;amp;yesterday._&amp;amp;trans_n..csv"
REPLACE
DBMS=CSV;
run;&lt;/PRE&gt;
&lt;P&gt;The NOB= option on the set statement returns the number of observations in the data set. This is just one way to get the info but may be the shortest. The Call Symputx places the value using a default format into a macro variable. Since already using a data step add in another step to use the INTNX function to get the previous day and use the YYMMDDN.8 format which generates values like 20230222.&lt;/P&gt;
&lt;P&gt;The . is used to indicate the end of a macro variable. So when there is a macro variable next to the dot in an extension you need to add one so that the macro processor does not use the one intended for the extension.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you really need to use less friendly dates or add () change the format in the Call Symputx and and the () to the name around the Trans_n macro variable.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Feb 2023 12:36:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/NUMBER-OF-TRANSACTION-AS-FILE-NAME/m-p/860149#M37994</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-02-22T12:36:04Z</dc:date>
    </item>
  </channel>
</rss>

