BookmarkSubscribeRSS Feed
Frank_Boekamp
Quartz | Level 8
Hi there,
 
I'm stuck with a piece of code that always worked on SAS 9.4. It should import a complex hierarchical XML file automatically to several SAS datasets. I can read the xml file in a datastep without any problems. But using the xmlv2 engine combined with automap option gives an error. The code I'm trying is this;
 
filename xml_in filesrvc folderpath='/Users/myname/test/' filename='xml_in.xml';
filename xx_map temp;
 
libname xml_in xmlv2 xmlfileref=xml_in automap=replace xmlmap=xx_map; 
proc copy in=xml_in out=work;
run; quit;
The error;
ERROR: The AUTOMAP= option accesses files that are specified with either a physical location or associated with a fileref device type of DISK or TEMP only.
 
any ideas?
 
Cheers,
Frank

 
2 REPLIES 2
alexal
SAS Employee

@Frank_Boekamp ,

 

You must specify the physical location of an existing XML document with either the complete pathname, filename, and file extension, or with a file reference that is associated with the physical location for the DISK or TEMP device type only. The XML document must exist on disk.

 

AUTOMAP=

Frank_Boekamp
Quartz | Level 8

Reading and writing XML is working fine using next code;

 

filename xml_in filesrvc folderpath='/Users/myname/test/' filename='xml_in.xml';
filename xml_out filesrvc folderpath='/Users/myname/test/' filename='xml_out.xml';

data test;
	length line $ 32676;;
	infile xml_in lrecl=32767;
	file xml_out_out;
	input line;
	put _infile_;
run;

 

Using  complete pathname, filename, and file extension in a filename statement seems not to work in SAS Viya. 

 

So I'm puzzled what to do with the libname statement with the automap option.

libname xml_in xmlv2 xmlfileref=xml_in automap=replace xmlmap=xx_map; 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

Discussion stats
  • 2 replies
  • 1649 views
  • 0 likes
  • 2 in conversation