<?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 Capture filesize of a file on Windows system in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24173#M4040</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking to find out how to pull a value for filesize from a file on Windows system via SAS program. I have this chunk of sas code below which I cant figure out how to use the value it generates beyond a "put" statement for the log. (This could be a bigger issue of my understanding of how to declare variables and easily reuse the values, which currently seems very counter intutive from my .net coding experience). But here is the code I am working with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;filename _in "C:\Somefile.ext";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;data _null_; &lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;recfm=F end=last;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ctr is virtually gone once it puts...(caput??) I want to use this value... how do I do this? Seems like I should be able to do something like %LET filesize = ctr, but %LET apparently does not work like a declare &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If someone would please let me know how to declare a variable, assign it the "ctr" value from the data block calculation and then use this value attached to my variable later in the program this will be very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;infile _in lrecl=1 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;input;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;ctr+1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;if last then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;put ctr;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 30 Jun 2011 20:50:25 GMT</pubDate>
    <dc:creator>bbpatterson</dc:creator>
    <dc:date>2011-06-30T20:50:25Z</dc:date>
    <item>
      <title>Capture filesize of a file on Windows system</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24173#M4040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking to find out how to pull a value for filesize from a file on Windows system via SAS program. I have this chunk of sas code below which I cant figure out how to use the value it generates beyond a "put" statement for the log. (This could be a bigger issue of my understanding of how to declare variables and easily reuse the values, which currently seems very counter intutive from my .net coding experience). But here is the code I am working with:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;filename _in "C:\Somefile.ext";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;data _null_; &lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;recfm=F end=last;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ctr is virtually gone once it puts...(caput??) I want to use this value... how do I do this? Seems like I should be able to do something like %LET filesize = ctr, but %LET apparently does not work like a declare &lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://communities.sas.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If someone would please let me know how to declare a variable, assign it the "ctr" value from the data block calculation and then use this value attached to my variable later in the program this will be very helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;infile _in lrecl=1 &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;input;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;ctr+1;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;if last then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;put ctr;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2011 20:50:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24173#M4040</guid>
      <dc:creator>bbpatterson</dc:creator>
      <dc:date>2011-06-30T20:50:25Z</dc:date>
    </item>
    <item>
      <title>Re: Capture filesize of a file on Windows system</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24174#M4041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is one possibility using the "External File" functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; info(keep=info:);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; filename $&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;8&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; infoname $&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;32&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; infoval $&lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;128&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; rc = filename(filename,&lt;/SPAN&gt;&lt;STRONG style="color: purple; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;'file path/name here'&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;(rc eq &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; fid=fopen(filename) &lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;while&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;(fid ne &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;0&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; i = &lt;/SPAN&gt;&lt;STRONG style="color: teal; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;to&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt; foptnum(fid);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infoname=foptname(fid,i);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infoval=finfo(fid,infoname);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fid=fclose(fid);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc = filename(filename,&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: purple; font-family: 'Courier New'; background-color: white;"&gt;'CLEAR'&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 10pt; color: blue; font-family: 'Courier New'; background-color: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;print&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: black; font-family: 'Courier New'; background-color: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;STRONG style="color: navy; font-size: 10pt; background-color: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 30 Jun 2011 21:38:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24174#M4041</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-06-30T21:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: Capture filesize of a file on Windows system</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24175#M4042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you can use pipe ability,then it will be easy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;filename fsize pipe 'dir c:\temp\';
data _null_ ;
 infile fsize ;
 input;
 put _infile_;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Jul 2011 03:02:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24175#M4042</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-07-01T03:02:41Z</dc:date>
    </item>
    <item>
      <title>Capture filesize of a file on Windows system</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24176#M4043</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; instead of&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;if last then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;put ctr;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;if last then&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;CALL SYMputX( 'CTR', ctr );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then later code will be able to use &amp;amp;ctr to refer to the value that was in data set variable CTR&lt;/P&gt;&lt;P&gt;Like&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;title "&amp;amp;ctr items in the report" ;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2011 14:27:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24176#M4043</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-07-11T14:27:10Z</dc:date>
    </item>
    <item>
      <title>Capture filesize of a file on Windows system</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24177#M4044</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a command that we can use it for checking the file size in windows environment( through DOS prompt)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;for %I in (testfile.txt) do @echo %~ZI&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We can execute windows command inside SAS using 'X' Command statement or CALL SYSTEM routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dhanasekaran R&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2011 12:58:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24177#M4044</guid>
      <dc:creator>dhana</dc:creator>
      <dc:date>2011-07-12T12:58:44Z</dc:date>
    </item>
    <item>
      <title>Capture filesize of a file on Windows system</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24178#M4045</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code you originally posted looks like it was designed to deterime the number of records in the text file, not the file size in bytes.&amp;nbsp; You'll have a bit of trouble with this code under windows for a couple of reasons:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; Your code specifies RECFM=F for the input file.&amp;nbsp; This indicates that the text file has fixed length records, i.e. every line in the text file is exactly the same number of characters long.&amp;nbsp; Windows doesn't produce fixed record files - windows text file are variable records length format (RECFM=V). So unless the file was created on another system (probably a mainframe) you should use RECFM=V instead of RECFM=F.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2.&amp;nbsp; The default input buffer size on Windows is 256 bytes.&amp;nbsp; If any individual record in the ext file is more than 256 bytes long, the record will be truncated in the input buffer. Specifying an input buffer size LARGER than the largest record has no ill effect other than consuming a few bytes more of memory.&amp;nbsp; You can specify the input buffer size (Logical RECord Length) with the LRECL= option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.&amp;nbsp; If, during a DATA step, you want to put a value into a macro variable for use in downstream program steps, you need a data step function like CALL SYMPUTX().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;%let File=C:\Somefile.ext;
filename _in "&amp;amp;file" lrecl=32767;
 
data _null_; 
&amp;nbsp;&amp;nbsp; infile _in end=last;
&amp;nbsp;&amp;nbsp; input;
&amp;nbsp;&amp;nbsp; ctr+1;
&amp;nbsp;&amp;nbsp; if last then call symputx('ctr',ctr);
run;

filename _in clear;

%PUT NOTE: &amp;amp;file contains &amp;amp;ctr records.;

&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jul 2011 01:02:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Capture-filesize-of-a-file-on-Windows-system/m-p/24178#M4045</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2011-07-13T01:02:59Z</dc:date>
    </item>
  </channel>
</rss>

