09-08-2011 11:17 AM
I have program that imports the source data into sas dataset daily. Is it possible in SAS to create empty data file and export it to some location when the actual source file is not found ?
09-08-2011 11:24 AM
Of course! You can use either a datastep or proc sql and just assign a libname to the directory where you want it to exist. e.g.,
PROC SQL noprint;
CREATE TABLE CORP.want
09-08-2011 11:42 AM
Do you want a data set with variables and zero obs or zero variables and zero obs? If you want variables and zero obs do you have a data set where the variable attributes can be copied from? For 0:0 you can use.
2128 data zero;
NOTE: The data set WORK.ZERO has 0 observations and 0 variables.
The 0:0 data could be used in a program to add obs to an existing data set. Where nothing happens unless the 0:0 is not 0:0 but actually has variables and observations.
2136 data class;
2137 set sashelp.class;
NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.CLASS has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
real time 0.01 seconds
cpu time 0.00 seconds
2139 data class;
2140 if 0 then modify class;
2141 set zero;
NOTE: The data set WORK.CLASS has been updated. There were 0 observations rewritten, 0
observations added and 0 observations deleted.
NOTE: There were 0 observations read from the data set WORK.ZERO.
So as you see it depends on what you have and what you want. :smileygrin:
09-10-2011 07:51 PM
I need to create empty table with variables. Also, is it possible to check to see if the file exist if it does then use the original file as main source if it does not create empty data set to avoid the error.
Thanks in advance.
Need further help from the community? Please ask a new question.