DATA Step, Macro, Functions and more

Export to XML

Reply
Super Contributor
Posts: 621

Export to XML

[ Edited ]

I'm trying to convert the SAS dataset to XML, but I end up with error as mentioned below. Could you please help me understand the cause for this issue?

libname dds xml "/TST/wrk1/dynamic_pricing.xml";

data dds.dynamic_pricing;
set WORK.DPF_OUTPUTSAS_EXAMPLE1_0001;
run;
Error.png

  Error.png

Super User
Posts: 9,614

Re: Export to XML

Make sure that the XML file does not exist already.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Super Contributor
Posts: 621

Re: Export to XML

Posted in reply to KurtBremser

XML file doesn't exist before.

Super User
Posts: 9,614

Re: Export to XML

[ Edited ]

I see. When running this code:

libname out xml '$HOME/sascommunity/class.xml';

data out.class;
set sashelp.class;
run;

I get the same message, but the log

24         libname out xml '$HOME/sascommunity/class.xml';
NOTE: Libref OUT was successfully assigned as follows: 
      Engine:        XML 
      Physical Name: $HOME/sascommunity/class.xml
25         
26         data out.class;
27         set sashelp.class;
28         run;

NOTE: There were 19 observations read from the data set SASHELP.CLASS.
NOTE: The data set OUT.CLASS has 19 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.13 seconds
      cpu time            0.02 seconds

clearly shows that the step worked. But EG can't display the resulting dataset, which seems to be a consequence of the internal SQL code that EG uses to retrieve data.

OTOH, doing

proc sql;
select * from out.class;
quit;

worked fine.

 

Edit:

But

proc sql;
select name, height from out.class;
quit;

produced totally wrong output, while not showing any problem in the log:

NAME       HEIGHT
-----------------
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0
ÿÿþ             0

So it seems that SAS (at least with proc sql) has some serious problems working with that engine. Open a track with SAS TS.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 3 replies
  • 105 views
  • 1 like
  • 2 in conversation