I have code that composes XML from parts that are stored in a table in a database. I export XML via the FILE command with options RECFM=N so that CRLF characters do not appear at the end. XML is encoded in UTF-8, but sas in WLATIN2.
If I use the setting RECFM=N, then SAS prompts encoding = UTF=8. If I don't use UTF8 encoding, the XML contains invalid characters...
How to export XML in UTF8?
proc sql noprint;select distinct PROCESS_IDinto :g_processIDList separated by ''from out_lib.Dbn_xml_data;quit;%put &g_processIDList.;%macro DAR_XML_PROCESSING1; %if %length(&g_processIDList.) ne 0 %then %do; %do i=1 %to %sysfunc(countw(&g_processIDList., '')); %let l_processID=%scan(&g_processIDList.,&i,%str( )); %put processing: &l_processID.; data HELP; set out_lib.DBN_XML_DATA (where=(PROCESS_ID = "&l_processID.")); run; proc sort data=HELP out=HELP (keep=XML_CONTENT); by PART_ID; run; filename out "\\somePath\&l_processID..xml" RECFM=N encoding="utf-8"; data _null_; file OUT; set HELP; put XML_CONTENT; run; %end; %end; %else %do; %put [NOTE]: nothing to process!!; %end;%mend DAR_XML_PROCESSING1;%DAR_XML_PROCESSING1;