Solved

How to create empty file in SAS?

Posted on 2015-02-09
3
394 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
3 Comments
 
LVL 8

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.

749 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