<?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 Re: Remove leading zeros ODS output in ODS and Base Reporting</title>
    <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Remove-leading-zeros-ODS-output/m-p/449801#M20755</link>
    <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; In the interest of completeness, you can get the results you want, in TAGSETS.EXCELXP by using a PICTURE format without using TAGATTR, as shown in the program code below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (keep= ID mydate);
  infile datalines;
  input ID mydate : mmddyy.;
  format mydate date9.;
datalines;
12 09/16/2015
15 06/02/2013
16 10/06/2016
;
run;
  

proc format;
   picture dfmt (default=10) other='%m/%d/%Y' (datatype=date);
run;

ods excel file='c:\temp\wantxlx.xlsx';
ODS TAGSETS.ExcelXP file= "c:\temp\want.xml"
    style=htmlblue;

PROC REPORT DATA= want split='*' nowd;
 column id mydate mydate=d1 mydate=d2;
 DEFINE mydate / Display  "mydate*tagattr*(will get default format)"
  style(column)= {tagattr="Format:m/d/yyyy;"  just=right} ;
 define d1 / display f=dfmt. 'd1*no tagattr*only picture format'
  style(column)= {just=right} ;
 define d2 / display f=dfmt. 'd2*with tagattr*and picture format'
  style(column)= {tagattr="Format:m/d/yyyy;"  just=right} ;

run;

ods tagsets.excelxp close;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The hitch with TAGSETS.EXCELXP is that as you can see below -- without a format and even using TAGATTR, with TAGSETS.EXCELXP, the output uses the SAS format for the column:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="no_lead_zero.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19537i38939A1CB7652BFC/image-size/large?v=v2&amp;amp;px=999" role="button" title="no_lead_zero.png" alt="no_lead_zero.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But, you can achieve what you want without making a character variable using a PICTURE format (or using TAGATTR).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
    <pubDate>Thu, 29 Mar 2018 23:29:05 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2018-03-29T23:29:05Z</dc:date>
    <item>
      <title>Remove leading zeros ODS output</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Remove-leading-zeros-ODS-output/m-p/449674#M20748</link>
      <description>&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;data want (keep= ID mydate);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;set want1;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;run;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUTPUT&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp; mydate&lt;BR /&gt;12&amp;nbsp;&amp;nbsp;&amp;nbsp; 09/16/2015&lt;BR /&gt;15&amp;nbsp;&amp;nbsp;&amp;nbsp; 06/02/2013&lt;BR /&gt;16&amp;nbsp;&amp;nbsp;&amp;nbsp; 10/06/2016&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ODS&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; TAGSETS.ExcelXP &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;file&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt; "c:/want,xml";&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size="3"&gt;PROC REPORT DATA=&amp;nbsp;want&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&amp;nbsp;headskip split=&lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;'*'&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; wrap nowd&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;COLUMNS _all_;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DEFINE mydate / Display style(column)= {&amp;nbsp;cellwidth=80pt just=right} "mydate";&lt;/P&gt;
&lt;P&gt;run&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to remove any leading zeros that may exist.&amp;nbsp; The desired output would be&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;OUTPUT&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;ID&amp;nbsp;&amp;nbsp;&amp;nbsp; mydate&lt;BR /&gt;12&amp;nbsp;&amp;nbsp;&amp;nbsp; 9/16/2015&lt;BR /&gt;15&amp;nbsp;&amp;nbsp;&amp;nbsp; 6/02/2013&lt;BR /&gt;16&amp;nbsp;&amp;nbsp;&amp;nbsp; 10/6/2016&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;Would tagattr be required for something like this??&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-WRAPPER&gt;&lt;/LI-WRAPPER&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 14:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Remove-leading-zeros-ODS-output/m-p/449674#M20748</guid>
      <dc:creator>Q1983</dc:creator>
      <dc:date>2018-03-29T14:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading zeros ODS output</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Remove-leading-zeros-ODS-output/m-p/449754#M20754</link>
      <description>&lt;P&gt;You could try something like this on your "want1" dataset:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a;&lt;BR /&gt;date="01jan2018"d;&lt;BR /&gt;newdate=catx('/',month(date),day(date),year(date));&lt;BR /&gt;format date mmddyys10.0;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 19:41:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Remove-leading-zeros-ODS-output/m-p/449754#M20754</guid>
      <dc:creator>mdavidson</dc:creator>
      <dc:date>2018-03-29T19:41:16Z</dc:date>
    </item>
    <item>
      <title>Re: Remove leading zeros ODS output</title>
      <link>https://communities.sas.com/t5/ODS-and-Base-Reporting/Remove-leading-zeros-ODS-output/m-p/449801#M20755</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; In the interest of completeness, you can get the results you want, in TAGSETS.EXCELXP by using a PICTURE format without using TAGATTR, as shown in the program code below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want (keep= ID mydate);
  infile datalines;
  input ID mydate : mmddyy.;
  format mydate date9.;
datalines;
12 09/16/2015
15 06/02/2013
16 10/06/2016
;
run;
  

proc format;
   picture dfmt (default=10) other='%m/%d/%Y' (datatype=date);
run;

ods excel file='c:\temp\wantxlx.xlsx';
ODS TAGSETS.ExcelXP file= "c:\temp\want.xml"
    style=htmlblue;

PROC REPORT DATA= want split='*' nowd;
 column id mydate mydate=d1 mydate=d2;
 DEFINE mydate / Display  "mydate*tagattr*(will get default format)"
  style(column)= {tagattr="Format:m/d/yyyy;"  just=right} ;
 define d1 / display f=dfmt. 'd1*no tagattr*only picture format'
  style(column)= {just=right} ;
 define d2 / display f=dfmt. 'd2*with tagattr*and picture format'
  style(column)= {tagattr="Format:m/d/yyyy;"  just=right} ;

run;

ods tagsets.excelxp close;
ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The hitch with TAGSETS.EXCELXP is that as you can see below -- without a format and even using TAGATTR, with TAGSETS.EXCELXP, the output uses the SAS format for the column:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="no_lead_zero.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/19537i38939A1CB7652BFC/image-size/large?v=v2&amp;amp;px=999" role="button" title="no_lead_zero.png" alt="no_lead_zero.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But, you can achieve what you want without making a character variable using a PICTURE format (or using TAGATTR).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 29 Mar 2018 23:29:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/ODS-and-Base-Reporting/Remove-leading-zeros-ODS-output/m-p/449801#M20755</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-03-29T23:29:05Z</dc:date>
    </item>
  </channel>
</rss>

