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

 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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