• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 592
  • Last Modified:

How to create empty file in SAS?

I am simply trying to create an empty file in SAS.

Is this a correct way or may be there is a more efficient way?  I am just want to create an empty file, not a SAS dataset.

filename myfile "/mydir/emtyfile.done";

data _null_;
 'x touch myfile';
run; 

Open in new window

0
labradorchik
Asked:
labradorchik
1 Solution
 
James BilousSoftware EngineerCommented:
This discussion from the SAS forums has several solutions depending on exactly what you desire:

https://communities.sas.com/message/104612
0
 
Aloysius LowCommented:
that is definitely not the correct code, unless you want the filename of the file created to be myfile, in the default execution directory.

if you use x command, you are passing the entire instruction to the OS to execute, so it has to be correctly structured, and appear exactly how you would do so when in the command line:
x "touch /mydir/emtyfile.done";

Open in new window


it can also run standalone, without being needed to be enclosed in a data step.

this is the quickest way to do what you need to do, assuming also that you have command line access within your SAS session.. otherwise, you'll need to write a data step to create an outfile
0
 
labradorchikAuthor Commented:
Hello, I am sorry for the late response!
Below code worked just fine!

data _null_;
 x "touch myfile";
run; 

Open in new window


Thank you for your help!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now