<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Write XML according data step in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59601#M12920</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You haven't responded to my earlier questions, but I just noticed something else that you will have to change. Within the same datastep you use %let to assign a value to a macro variable and then try to use that macro variable within the same datastep.&amp;nbsp; That won't work!&amp;nbsp; You will have to move the %let statement outside of the datastep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 01 Sep 2011 15:12:48 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2011-09-01T15:12:48Z</dc:date>
    <item>
      <title>Write XML according data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59598#M12917</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First I select all variabel names from a data set edc_recipe. Afterwards i select the names that i want seperated by #.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I want to loop through the list and print for every variable an XML Tag &amp;lt;name&amp;gt; value &amp;lt;/name&amp;gt; (see orange part)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Who can help me?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data colnames(keep=vname);&lt;BR /&gt;&amp;nbsp; set RF300l3.edc_recipe (obs=1) ;&lt;BR /&gt;&amp;nbsp; array n{*} _NUMERIC_ ;&lt;BR /&gt;&amp;nbsp; array c{*} _CHARACTER_ ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do i = 1 to dim(n) ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; vname = vname(n{i}) ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; output ;&lt;BR /&gt;&amp;nbsp; end ;&lt;BR /&gt;&amp;nbsp; do i = 1 to dim(c) ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; vname = vname(c{i}) ;&lt;BR /&gt;output;&lt;BR /&gt;&amp;nbsp; end ;&lt;BR /&gt;run ;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;proc sql;&lt;BR /&gt;select vname into:test separated by '#' from colnames where vname not in ('Date','Datim','Serial_No','NrWafers','col_ins_row_id','Facility','LotId') ;&lt;BR /&gt;quit;&lt;BR /&gt;%put &amp;amp;test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data _null_;&lt;BR /&gt;file outxml;&lt;BR /&gt;%let tab=" ";&lt;BR /&gt;set&amp;nbsp; output_data_keep NOBS=Lst;&lt;BR /&gt;if _n_=1 then do;&lt;BR /&gt;put '&amp;lt;?xml version="1.0" ?&amp;gt;';&lt;BR /&gt;put '&amp;lt;lot&amp;gt;';&lt;BR /&gt;end;&lt;BR /&gt;put '&amp;lt;Row&amp;gt;';&lt;BR /&gt;if type = 'RECIPE' then do;&lt;BR /&gt;put &amp;amp;tab'&amp;lt;Params&amp;gt;';&lt;BR /&gt;&lt;SPAN style="color: #ff6600;"&gt;&amp;nbsp; j = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp; do while (scan(&amp;amp;test,j,'#') NE '');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff6600;"&gt;&amp;nbsp; Temp = scan(&amp;amp;test,j,'#');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff6600;"&gt;&amp;nbsp; put &amp;amp;tab &amp;amp;tab '&amp;lt;Temp&amp;gt;' vvaluex(Temp) '&amp;lt;/Temp&amp;gt;';&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff6600;"&gt;&amp;nbsp;&amp;nbsp; j= j+1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN style="color: #ff6600;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;BR /&gt;put &amp;amp;tab'&amp;lt;/Params&amp;gt;';&lt;BR /&gt;end;&lt;BR /&gt;put '&amp;lt;/Row&amp;gt;';&lt;BR /&gt;if _n_ = lst then do;&lt;BR /&gt;put '&amp;lt;/lot&amp;gt;';&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;BR /&gt;ods xml close;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 12:52:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59598#M12917</guid>
      <dc:creator>Filipvdr</dc:creator>
      <dc:date>2011-09-01T12:52:41Z</dc:date>
    </item>
    <item>
      <title>Write XML according data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59599#M12918</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can help you with the first part.&amp;nbsp; Why not just use something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql noprint;&lt;/P&gt;&lt;P&gt;&amp;nbsp; select name into:test&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; separated by '#'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from dictionary.columns&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; where libname="RF300L3"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and memname="EDC_RECIPE"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; and name not in ('Date','Datim','Serial_No',&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'NrWafers','col_ins_row_id','Facility','LotId')&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As for the second part, you use the file statement, but never associated it with a file name.&amp;nbsp; Was that intentional.&amp;nbsp; Then, at the end, you close ods xml, but never opened it.&amp;nbsp; Aren't you just trying to write a text file with an xml extension?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 13:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59599#M12918</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-01T13:20:44Z</dc:date>
    </item>
    <item>
      <title>Write XML according data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59600#M12919</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;filename tmp temp;&lt;/P&gt;&lt;P&gt;ods xml file=tmp;&lt;/P&gt;&lt;P&gt;/* using ods will add some tags you may not want by default, I do not know of options to remove these tags but it doesn't mean they don't exist, possibly using proc template... */&lt;/P&gt;&lt;P&gt; proc print data=sashelp.class; run;&lt;/P&gt;&lt;P&gt;ods xml close;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reference materials concerning the SAS XML Libname Engine:&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/rnd/base/xmlengine/index.html"&gt;http://support.sas.com/rnd/base/xmlengine/index.html&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 15:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59600#M12919</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2011-09-01T15:06:13Z</dc:date>
    </item>
    <item>
      <title>Write XML according data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59601#M12920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You haven't responded to my earlier questions, but I just noticed something else that you will have to change. Within the same datastep you use %let to assign a value to a macro variable and then try to use that macro variable within the same datastep.&amp;nbsp; That won't work!&amp;nbsp; You will have to move the %let statement outside of the datastep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 15:12:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59601#M12920</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-01T15:12:48Z</dc:date>
    </item>
    <item>
      <title>Write XML according data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59602#M12921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Filip&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;without the data step specifying the tags, you might achieve what you need with the XML libname engine.&lt;/P&gt;&lt;P&gt;Have a look at &lt;A href="http://support.sas.com/documentation/cdl/en/engxml/63177/HTML/default/p0c5z18meh4ilzn1cw71t8waayjq.htm"&gt;http://support.sas.com/documentation/cdl/en/engxml/63177/HTML/default/p0c5z18meh4ilzn1cw71t8waayjq.htm&lt;/A&gt; for SAS9.3 XML Guide or &lt;A href="http://support.sas.com/documentation/cdl/en/engxml/62845/HTML/default/a002592584.htm"&gt;http://support.sas.com/documentation/cdl/en/engxml/62845/HTML/default/a002592584.htm&lt;/A&gt; for exporting to XML in SAS9.2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;peterC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Sep 2011 15:35:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59602#M12921</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2011-09-01T15:35:25Z</dc:date>
    </item>
    <item>
      <title>Write XML according data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59603#M12922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of generating the list with # delimiter generate it as a comma separated list of quoted strings.&lt;/P&gt;&lt;P&gt;Then you can just use a DO loop to output the tagged values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let vlist = 'Name', 'Age', 'Sex' ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set sashelp.class ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do _name = &amp;amp;vlist ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; _start=cats('&amp;lt;',_name,'&amp;gt;');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; _end=cats('&amp;lt;/',_name,'&amp;gt;');&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; _val = quote(strip(vvaluex(_name)));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; put _start _val _end @;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Sep 2011 02:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59603#M12922</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2011-09-02T02:42:08Z</dc:date>
    </item>
    <item>
      <title>Re: Write XML according data step</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59604#M12923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Art: I didnt post all my code. My XML is generated fine, I just have a problem with the orange part I want to solve.&lt;/P&gt;&lt;P&gt;@FriedEgg: I want really specific XML which i think can not be generated by a proc print or something else.&lt;/P&gt;&lt;P&gt;@Peter C.: I work with 9.1.3 here. At other project I worked indeed with XML Libname engine, but not here because i really need specific XML&lt;/P&gt;&lt;P&gt;@Tom: your reply is a possible answer to my question, i'm going to try it out now..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: Tom, I created my own VLIST:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;'ProcessPlan','MainTool','user_id','Wafers_1','RecipeName_1','RecipeValue_1','RecipeName_2','Recip&lt;/P&gt;&lt;P&gt;eValue_2','RecipeName_3','RecipeValue_3','RecipeName_4','RecipeValue_4','RecipeRptName_1','RecipeR&lt;/P&gt;&lt;P&gt;ptValue_1','RecipeRptName_2','RecipeRptValue_2','RecipeRptName_3','RecipeRptValue_3','RecipeRptNam&lt;/P&gt;&lt;P&gt;e_4','RecipeRptValue_4','RecipeRptName_5','RecipeRptValue_5','StepServices_1','StepServices_2','St&lt;/P&gt;&lt;P&gt;epServices_3','StepServices_4','StepServices_5','col_ins_id','sstrMainStep','sstrCycleTimeExpected&lt;/P&gt;&lt;P&gt;','sstrReleaseStatus','RecipeParameters_1','RecipeParameters_2','RecipeParameters_3','RecipeParame&lt;/P&gt;&lt;P&gt;ters_4'&lt;/P&gt;&lt;SPAN style="font-size: 8pt;"&gt;&lt;P&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When i want to loop through the list it seems to cut these long parameternames somehow, any idea what this could be?&lt;/P&gt;&lt;P&gt;Variable like ProcessPlan, Maintool, User all goes ok till Recipename_1..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: Solution: Adding a format for _name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks Tom! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV class="mcePaste" id="_mcePaste" style="left: -10000px; overflow: hidden; width: 1px; position: absolute; top: 0px; height: 1px;"&gt;﻿&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Sep 2011 05:47:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Write-XML-according-data-step/m-p/59604#M12923</guid>
      <dc:creator>Filipvdr</dc:creator>
      <dc:date>2011-09-02T05:47:36Z</dc:date>
    </item>
  </channel>
</rss>

