DATA Step, Macro, Functions and more

writing xml using data step cannot write more than 200 character

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 12
Accepted Solution

writing xml using data step cannot write more than 200 character

while trying to export SAS dataset to xml file in specific schema 

i used the below code which works fine in case the whole line length less than 200 character 

<tag>+<field_name>+</tag> <=200 

else only 200 character from Left hand side are written into the output file 

please help as this field can be 4000 character and i cannot write it to the xml this way 

or if there is a better way to write xml file using dataset which contain two columns 

 

 

filename outxml '<file-path>';
data _null_;
set work.<dataset_name> NOBS=lst;
put '<tag>';
if (condition) then put <field_name> '</tag>' ; 
end;
run; 

Accepted Solutions
Solution
3 weeks ago
Super User
Super User
Posts: 7,955

Re: writing xml using data step cannot write more than 200 character

[ Edited ]
Posted in reply to Amahareek

Try: data _null_; file "c:\temp.xml" linesize=32767; ... run;

Or filename outxml 'c:\temp.xml' lrecl=32767;

View solution in original post


All Replies
Solution
3 weeks ago
Super User
Super User
Posts: 7,955

Re: writing xml using data step cannot write more than 200 character

[ Edited ]
Posted in reply to Amahareek

Try: data _null_; file "c:\temp.xml" linesize=32767; ... run;

Or filename outxml 'c:\temp.xml' lrecl=32767;
Occasional Contributor
Posts: 12

Re: writing xml using data step cannot write more than 200 character

thanks a lot it works with me
Frequent Contributor
Posts: 119

Re: writing xml using data step cannot write more than 200 character

Posted in reply to Amahareek

Consider using PROC STREAM.

Occasional Contributor
Posts: 12

Re: writing xml using data step cannot write more than 200 character

thanks i see it's a good option in case no condition to output if there is any way to put condition before output it would be better

 

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 112 views
  • 0 likes
  • 3 in conversation