BookmarkSubscribeRSS Feed
AmitSingh2
Calcite | Level 5

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.

6 REPLIES 6
Kurt_Bremser
Super User

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.

AmitSingh2
Calcite | Level 5
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 ?
AmitSingh2
Calcite | Level 5
Thanks for the info. Yes, CPORT works fine we have observed issues in XPORT only so not sure if it's a bug in SAS or we are doing things differently. We need to support both XPORT & CPORT.
Kurt_Bremser
Super User

We have had the discussion about empty datasets and the LOC2XPT/XPT2LOC macros just yesterday:

https://communities.sas.com/t5/SAS-Programming/xport-transport-file-not-extracting-empty-datasets-0/... 

Follow that discussion to see what SAS technical support has to say about the issue, and/or get in touch with SAS TS yourself.

Tom
Super User Tom
Super User

@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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 6 replies
  • 653 views
  • 0 likes
  • 3 in conversation