Solved

How to create empty file in SAS?

Posted on 2015-02-09
3
441 Views
Last Modified: 2016-02-13
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
Comment
Question by:labradorchik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Expert Comment

by:James Bilous
ID: 40599618
This discussion from the SAS forums has several solutions depending on exactly what you desire:

https://communities.sas.com/message/104612
0
 
LVL 14

Accepted Solution

by:
Aloysius Low earned 500 total points
ID: 40599935
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
 

Author Comment

by:labradorchik
ID: 40628885
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question