<?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: Empty text file using SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758323#M239428</link>
    <description>&lt;P&gt;Why this restriction to not use a data step? If you've got a Unix environment and option XCMD is set then you can use the Unix touch command via a SAS X command or similar coding options.&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jul 2021 05:06:29 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2021-07-30T05:06:29Z</dc:date>
    <item>
      <title>Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758322#M239427</link>
      <description>&lt;P&gt;hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to create a empty text file using SAS without using data step. How can I do that&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 04:55:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758322#M239427</guid>
      <dc:creator>shubham1</dc:creator>
      <dc:date>2021-07-30T04:55:37Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758323#M239428</link>
      <description>&lt;P&gt;Why this restriction to not use a data step? If you've got a Unix environment and option XCMD is set then you can use the Unix touch command via a SAS X command or similar coding options.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 05:06:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758323#M239428</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-07-30T05:06:29Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758324#M239429</link>
      <description>&lt;P&gt;We can use data step also .I do not have unix environment.You can provide me the solution&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 05:15:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758324#M239429</guid>
      <dc:creator>shubham1</dc:creator>
      <dc:date>2021-07-30T05:15:28Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758327#M239432</link>
      <description>&lt;P&gt;&lt;STRIKE&gt;Maybe&lt;/STRIKE&gt; By using fopen+fclose functions wrapped in a %sysfunc, &lt;STRIKE&gt;but i am not sure, if the file is created without writing to it.&lt;/STRIKE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;   %let filrf = myfile;
   %let rc = %sysfunc(filename(filrf, INSERT_PATH\empty.txt));
   %let fid = %sysfunc(fopen(&amp;amp;filrf, o));
   %let rc = %sysfunc(close(&amp;amp;fid));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 05:32:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758327#M239432</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-07-30T05:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758330#M239434</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  %let fid = %sysfunc(fopen(&amp;amp;filrf, o));  &lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Andreas has it right.&amp;nbsp; The trick is the "O" parameter on the FOpen.&amp;nbsp; If you wanted something with some error checking and that deallocates everything after creation, try the below.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET	Path		=	C:\Users\jbarbour\Documents\SAS\Pgm\Training\FOPEN;
%LET	Filename	=	FOPEN_Test.txt;
%let	filrf		=	myfile;

%**	Allocate the FileRef.	**;
%let rc				=	%sysfunc(filename(filrf, &amp;amp;Path\&amp;amp;Filename));
%if	&amp;amp;rc				^=	0	%then
	%DO;
		%put NOTE:  Based on FILENAME function:  &amp;amp;=rc;
		%put %sysfunc(sysmsg());
	%END;
%ELSE
	%DO;
		%put NOTE:  Allo of FileRef &amp;amp;filrf successful.  &amp;amp;=RC;
		%**	Open/create the file and create a File ID.	**;
		%let fid	=	%sysfunc(fopen(&amp;amp;filrf, O));
		%put NOTE:  Based on FOPEN function:  &amp;amp;=fid;
		%put %sysfunc(sysmsg());
		%**	Close/save the file.	**;
		%let rc		=	%sysfunc(FCLOSE(&amp;amp;fid));
		%put NOTE:  Based on FCLOSE function:  &amp;amp;=rc;
		%PUT %sysfunc(sysmsg());
	%END;

%**	Deallocate the FileRef.	**;
%let rc				=	%sysfunc(filename(filrf));
%put NOTE:  Based on FILENAME function:  &amp;amp;=rc;
%put %sysfunc(sysmsg());
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You may or may not want to deallocate the FileRef immediately depending on what you're doing, but I include it in the above example so that you know how to do it if you need to.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 06:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758330#M239434</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-30T06:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758344#M239438</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt; I want to create a empty text file using SAS without using data step. How can I do that&amp;nbsp;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;Under Windows, you can run something like this:&lt;/P&gt;
&lt;PRE&gt;x 'dir .* | find "#" &amp;gt; myfile.txt';&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 07:44:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758344#M239438</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-07-30T07:44:09Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758349#M239442</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;tryt this SAS code in Windows.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;x 'cmd /c echo.&amp;gt;c:\temp\sample.txt';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jul 2021 08:59:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758349#M239442</guid>
      <dc:creator>japelin</dc:creator>
      <dc:date>2021-07-30T08:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758367#M239448</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods csv file='c:\temp\void.csv';
proc sql;
select name label='#' from sashelp.class(obs=0);
quit;
ods csv close;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jul 2021 12:28:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758367#M239448</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-30T12:28:19Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758369#M239449</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc export data=sashelp.class(obs=0) outfile='c:\temp\want.txt' dbms=tab replace;
putnames=no;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jul 2021 12:33:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758369#M239449</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-30T12:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758376#M239452</link>
      <description>&lt;P&gt;Use the FILE statement without writing anything to it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  file 'c:\downloads\empty.txt' ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 30 Jul 2021 13:09:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758376#M239452</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-30T13:09:28Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758406#M239458</link>
      <description>Tom,&lt;BR /&gt;Great, Could you create an empty XLSX file ?</description>
      <pubDate>Fri, 30 Jul 2021 13:51:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758406#M239458</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-30T13:51:56Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758414#M239462</link>
      <description>&lt;P&gt;What is you definition of an empty XLSX?&lt;/P&gt;
&lt;P&gt;If you just want a zero byte file the extension on the file does not matter.&lt;/P&gt;
&lt;P&gt;I don't think Excel would be happy with a workbook that does not have any sheets.&amp;nbsp; Would you want a single sheet in the workbook?&amp;nbsp; What content should the sheet have?&amp;nbsp; I doubt you could make one that doesn't at least have something in at least on cell in the sheet.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 14:46:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758414#M239462</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-07-30T14:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758568#M239541</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/127952"&gt;@shubham1&lt;/a&gt;&amp;nbsp;It's as simple as below with a SAS datastep.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  file 'c:\temp\mytxt.txt';
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 31 Jul 2021 01:19:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758568#M239541</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-07-31T01:19:59Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758584#M239552</link>
      <description>&lt;P&gt;Just a empty excel file with Sheet1 and have nothing,.&lt;/P&gt;
&lt;P&gt;Just like you create a new excel file by right clicking mouse -&amp;gt; new create -&amp;gt; Microsoft Excel Sheet&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1627728563339.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62166i119B7F7F89F7CEB2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1627728563339.png" alt="Ksharp_0-1627728563339.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2021 10:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758584#M239552</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-31T10:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: Empty text file using SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758589#M239554</link>
      <description>&lt;P&gt;I post my solution here firstly for someone who need it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel file='c:\temp\x.xlsx' options(sheet_name='Sheet1') style=journal  ;
proc sql;
select name label='#' from sashelp.class(obs=0);
quit;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1627728748846.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/62167iABCAA735D015758D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1627728748846.png" alt="Ksharp_0-1627728748846.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 31 Jul 2021 10:52:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Empty-text-file-using-SAS/m-p/758589#M239554</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-07-31T10:52:50Z</dc:date>
    </item>
  </channel>
</rss>

