Understanding the XML Code for the List Data Task

This example shows the task definition for the List Data task and labels each element in the XML code.
<?xml version="1.0" encoding="UTF-8"?><Task schemaVersion="2.0">
1<Registration>
      <Name>List Data</Name>
      <Description>The List Data task displays the contents of a table as a 
         report.</Description>
      <GUID>3C74D5C3-B845-4926-A749-E56CBA1283E2</GUID>
      <Procedures>PRINT SORT</Procedures>
      <Version>3.2</Version>
      <Links>
         <Link href="http://support.sas.com/cdlsearch?nh=25&amp;ct=80000&amp;
            qt=PROC+PRINT">PROC PRINT Documentation</Link>
         <Link href="http://support.sas.com/cdlsearch?nh=25&amp;ct=80000&amp;
            qt=PROC+SORT">PROC SORT Documentation</Link>
      </Links>
</Registration>
2<Metadata>
   <DataSources>
      <DataSource name="DATASOURCE">
         <Roles>
            <Role maxVars="0" minVars="0" name="VAR" order="true" 
               type="A">List variables</Role>
            <Role maxVars="0" minVars="0" name="BY" order="true" 
               type="A">Group analysis by</Role>
            <Role maxVars="0" minVars="0" name="SUM" order="true" 
               type="N">Total of</Role>
            <Role maxVars="0" minVars="0" name="ID" order="true" 
               type="A">Identifying label</Role>
         </Roles>
      </DataSource>
   </DataSources>

   <Options>
      <Option defaultValue="all" inputType="combobox" name="ROWS2LIST" 
         width="264px">Rows to list:</Option>
      <Option inputType="string" name="all">All rows</Option>
      <Option inputType="string" name="firstnrows">First n rows</Option>
      <!--<Option inputType="string" name="firstnpct">First n percent
         of rows</Option>-->
      <!--<Option inputType="string" name="everynrow">Every nth row</Option>-->
         <Option decimalPlaces="0" defaultValue="10" indent="1" 
            inputType="numstepper" maxValue="999999" minValue="1"
            name="NVALUE">Amount (n):</Option>
         <!--<Option decimalPlaces="0" defaultValue="25" indent="1"
            inputType="numstepper" maxValue="100" minValue="1"
            name="NPERCENT">Percent (n):</Option>-->

      <Option inputType="string" name="DATATAB">DATA</Option>
      <Option inputType="string" name="DATAGROUP">DATA</Option>
      <Option inputType="string" name="ROLESGROUP">ROLES</Option>

      <Option inputType="string" name="OPTIONSTAB">OPTIONS</Option>
      <Option inputType="string" name="BASICOPTIONS">BASIC OPTIONS</Option>

      <Option defaultValue="1" inputType="checkbox" name="OBS">
         Display row numbers</Option>
      <Option defaultValue="Row number" indent="1" inputType="inputtext" 
         name="OBSHEADING" width="250px">Column label</Option>

      <Option defaultValue="1" inputType="checkbox" name="LABEL">Use column
         labels as column headings</Options>

      <Option defaultValue="0" inputType="checkbox" name="PRINTNUMROWS">Display
         number of rows</Option>

      <Option defaultValue="0" inputType="checkbox" name="ROUND">Round values
         before summing the variable</Option>

      <Option defaultValue="default" inputType="combobox" name="HEADING" 
         width="264px">Heading direction:</Option>
      <Option inputType="string" name="default">Default</Option>
      <Option inputType="string" name="horizontal">Horizontal</Option>
      <Option inputType="string" name="vertical">Vertical</Option>

      <Option defaultValue="default" inputType="combobox" name="WIDTH" 
         width="264px">Column width</Option>
      <Option inputType="string" name="full">Full</Option>
      <Option inputType="string" name="minimum">Minimum</Option>
      <Option inputType="string" name="uniform">Uniform</Option?
      <Option inputType="string" name="uniformby">Uniform by</Option>

      <Option defaultValue="0" inputType="checkbox" 
         name="SPLITLABEL">Split labels</Option>
      <Option defaultValue="*" indent="1" inputType="combobox" 
         name="SPLITLABELVALUE" 
         width="80px">Split character</Option>
   </Options>
</Metadata>
3<UI>
   <Container option="DATATAB">
      <Group open="true" option="DATAGROUP">
         <DataItem data="DATASOURCE"/>
      </Group>
      <Group open="true" option="ROLESGROUP">
         <RoleItem role="VAR"/>
         <RoleItem role="BY"/>
         <RoleItem role="SUM"/>
         <RoleItem role="ID"/>
      </Group>
   </Container>

   <Container option="OPTIONSTAB">

      <Group open="true" option="BASICOPTIONS">

         <OptionItem option="OBS"/>
         <OptionItem option="OBSHEADING"/>
         <OptionItem option="LABEL"/>
         <OptionItem option="PRINTNUMROWS"/>
         <OptionItem option="ROUND"/>

         <OptionChoice option="HEADING"/>
            <OptionItem option="default"/>
            <OptionItem option="horizontal"/>
            <OptionItem option="vertical"/>
         </OptionChoice>

         <OptionChoice option="WIDTH"/>
            <OptionItem option="default"/>
            <OptionItem option="full"/>
            <OptionItem option="minimum"/>
            <OptionItem option="uniform"/>
            <OptionItem option="uniformby"/>
         </OptionChoice>

         <OptionItem option="SPLITLABEL"/>
            <OptionChoice option="SPLITLABELVALUE"/>
               <OptionValue>*</OptionValue>
               <OptionValue>!</OptionValue>
               <OptionValue>@</OptionValue>
               <OptionValue>#</OptionValue>
               <OptionValue>$</OptionValue>
               <OptionValue>%</OptionValue>
               <OptionValue>^</OptionValue>
               <OptionValue>amp</OptionValue>
               <OptionValue>+</OptionValue>
         </OptionChoice>

            <OptionChoice option="ROWS2LIST"?
               <OptionItem option="all"/>
               <OptionItem option="firstnrows"/>
            </OptionChoice>

         <OptionItem option="NVALUE"/>

      </Group>
   </Container>
</UI>
4<Dependencies>
   <Dependency condition="OBS=='1'">
      <Target action="enable" conditionResult="true" option="OBSHEADING"/>
      <Target action="disable" conditionResult="false" option="OBSHEADING"/>
   </Dependency>
   <Dependency condition="$SPLITLABEL=='1'">
      <Target action="enable" conditionResult="true" option="SPLITLABELVALUE"/>
      <Target action="disable" conditionResult="false" option="SPLITLABELVALUE"/
   </Dependency>
   <Dependency condition="$ROWS2LIST.equalsIgnoreCase('firstnrows')">
      <Target action="enable" conditionResult="true" option="NVALUE"/>
      <Target action="disable" conditionResult="false" option="NVALUE"/
   </Dependency>

</Dependencies>
5<CodeTemplate>
   <![CDATA[

#set( $TABLE = $DATASOURCE )
title;
footnote;

title1 "List Data for $DATASOURCE";

#if( $BY.size()>0 ) /*Sort $DATASOURCE for BY group processing. */

proc sort data=$DATASOURCE out=WORK.SORTTEMP;
   by #foreach($item in $BY) $item#end;
run;
#set( $TABLE = "WORK.SORTTEMP" )
#end

/* Print the table     */

proc print data=$TABLE
#if($ROWS2LIST.equalsIgnoreCase("firstnrows"))
      (obs=$NVALUE)
#end
#if ($OBS == '1')
      obs="$OBSHEADING"
#else
      noobs
#end
#if ($HEADING && ($HEADING !="default"))
      heading=$HEADING
#end
#if ($LABEL == '1')
      label
#end
#if ($PRINTNUMROWS == '1')
      n
#end
#if ($ROUND == '1')
      round
#end
#if ($DIVIDE == "0")
      rows=page
#end
#if($WIDTH && ($WIDTH !='default'))
      width=$WIDTH
#end
#if ($SPLITLABEL == '1')
      split='$SPLITLABELVALUE'
#end
   ;
#if( $VAR.size()>0 )
      var #foreach ( $item in $VAR ) $item#end;
#end
#if( $BY.size()>0 )
      by #foreach ( $item in $BY ) $item#end;
#end
#if( $SUM.size()>0  )
      sum #foreach ( $item in $SUM ) $item#end;
#end
#if( $ID.size()>0  )
      id #foreach ( $item in $ID ) $item#end;
#end
run;
quit;

title;
footnote;
         ]]>
   </CodeTemplate>
</Task>
Use this list to identify each section in the preceding code:
1 The Registration element. For more information, see Working with the Registration Element.
2 The Metadata element specifies whether an input data source is required, defines the roles for columns in the input data source and any options that are required for the task to run. For more information, see Working with the Metadata Element.
3 The UI element specifies the layout of the task in the user interface. For more information, see Working with the UI Element.
4 The Dependencies element specifies the options that rely on one another in order for the task to work. For more information, see Working with the Dependencies Element.
5 The Code Template element generates the SAS code for the task. For more information, see Understanding the Code Template.