Solved

How to create empty file in SAS?

Posted on 2015-02-09
3
333 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now