Does sas xport supports rendering empty data set files along with data sets with data. Empty data set files are showing all the files data which follows it later as jumbled up. The empty data set has only sas variable and sas label defined but no data or observations.
The XPORT engine can deal perfectly well with "empty" (variables, but no observations) datasets. Run this for reference:
proc datasets lib=work kill nolist;
quit;
data d1;
x = 0;
stop;
run;
data d2;
x = 0;
stop;
run;
data d3;
x = 0;
stop;
run;
libname xpt xport "~/test.xpt";
proc copy in=work out=xpt memtype=data;
select d:;
run;
libname xpt clear;
libname xpt xport "~/test.xpt";
proc datasets lib=work kill nolist;
quit;
proc copy in=xpt out=work;
run;
libname xpt clear;
The filename of the transport file is designed for SAS On Demand, you may need to modify it.
If you need V8 and later attributes in a transport file, use PROC CPORT/CIMPORT.
We have had the discussion about empty datasets and the LOC2XPT/XPT2LOC macros just yesterday:
Follow that discussion to see what SAS technical support has to say about the issue, and/or get in touch with SAS TS yourself.
@AmitSingh2 wrote:
We are using macros %loc2xpt(libref=source, filespec=xpt, FORMAT=V8) to generate not the xport engine as it limits to V5. Is it possible with v8 ?
To summarize the discussion from yesterday on another thread.
The %XPT2LOC() macro has a bug. It is not detecting the end of the data properly for 0 observations datasets when there are other datasets that come after it in the same transport file.
So the solutions are:
1) Put only one dataset per xport file.
2) Use CPORT format instead
3) Use V5 (v6) compatible datasets and use the actual XPORT engine instead of the macros.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.