1
votes

I would like to read input txt file which has only one string (xml message). I try:

data res;
length result $500;
infile 'C:\Temp\RESPONSE.xml';
input result;
run;

But in the result data set in result variable I see only a part of string before the first space.

The string in the RESPONSE.xml file is a simple xml messge with some tags.

What option should I enable in data set to read the full string from infile RESPONSE.xml

2

2 Answers

1
votes

I'll have a go at this. Seems like you might have a messy .xml file. If this is the case, you will have to specify the XMLMAP. I don't know what tags you have or the layout of your tags from your description. But you can try the simple libname statement with the xml engine first if the .xml file is not too messy.

libname my xml 'C:\sasdata\sample.xml';
data work.sample2;
    set my.sample;
run;

On the other hand, if you have SAS 9.1.3 or newer, there might be a XMLMAP program in your version which you can make XML maps which outlines the boundaries of the currently imported .xml file.

"Very" rough sketch of XMLMAP:

filename my 'C:\sasdata\sample.xml';
filename map 'C:\sasdata\sample.map';
libname my xlm xmlmap=map;

Alternatively, you can also try to open your .xlm file in Excel. Then save it as an Excel file and use proc import to import it into SAS. You might need to download the Excel XMLTools add-in though.

-1
votes
    data _null_;      
  file "directory/tlg.xml" mod;
  set sample;
        put '...';
        ......
    run;