BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Amahareek
Fluorite | Level 6

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; 
1 ACCEPTED SOLUTION

Accepted Solutions
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

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

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

Or filename outxml 'c:\temp.xml' lrecl=32767;
Amahareek
Fluorite | Level 6
thanks a lot it works with me
AlanC
Barite | Level 11

Consider using PROC STREAM.

https://github.com/savian-net
Amahareek
Fluorite | Level 6

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

 

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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