<?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: Leading zero of my character string is dropped in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/311033#M67118</link>
    <description>&lt;P&gt;Thanks so much for the help. I appreciate your time.&lt;/P&gt;</description>
    <pubDate>Fri, 11 Nov 2016 18:17:48 GMT</pubDate>
    <dc:creator>buechler66</dc:creator>
    <dc:date>2016-11-11T18:17:48Z</dc:date>
    <item>
      <title>Leading zero of my character string is dropped</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/310983#M67102</link>
      <description>&lt;P&gt;Hi. The resulting dataset stores the 5 character imb_dlvry_zip_5 without leading zeros. So an imb_dlvry_zip_5 of 02367 is stored as 2367. The result is that the following Proc Print also outputs the imb_dlvry_zip_5 value without the leading zero. &amp;nbsp;How can I prevent it from doing this? &amp;nbsp;I'd appreciate any help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
 create table HighsAndLows as 
 select imb_dlvry_zip_5, rule_nm, rule_order, percent, total
 from myDSs.QueryDataSummary&amp;amp;QTR
 where imb_dlvry_zip_5 &amp;lt;&amp;gt; '164'
   and rule_nm NOT in('TOTAL BIDS VOLUME SAMPLED')
 group by rule_nm
 having total = max(total) or total = min(total)
 order by rule_order, rule_nm, total, imb_dlvry_zip_5;
quit;&lt;BR /&gt;&lt;BR /&gt;proc print label noobs;&lt;BR /&gt;label imb_dlvry_zip_5 = 'ZIP5';&lt;BR /&gt;run;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Nov 2016 14:16:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/310983#M67102</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-11-11T14:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Leading zero of my character string is dropped</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/310984#M67105</link>
      <description>&lt;P&gt;Please post example data of what you have. &amp;nbsp;If IMB_DLVRY is indeed character in the table you take the data from then it would be character in the output as well, hence it would retain the "0" at the front. &amp;nbsp;If however it is numeric, then the default is to not have leading zeros as they are meaningless. &amp;nbsp;You can use Zx. format if you really need them, but Excel and things will remove them also unless you stipulate text.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2016 14:23:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/310984#M67105</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-11-11T14:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Leading zero of my character string is dropped</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/310985#M67106</link>
      <description>&lt;P&gt;To display numeric values with leading zeroes, use the Zw. format. To store such values, you need to put them into a character variable, using the same Zw. format.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2016 14:24:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/310985#M67106</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-11-11T14:24:04Z</dc:date>
    </item>
    <item>
      <title>Re: Leading zero of my character string is dropped</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/310990#M67107</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'v traced the imb_dlvry_zip_5 variable from the original permanent ds to the temporary ds following the Proc SQL and it remains a character value throughout and retains the leading zero.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So it now seems as tho it's my output using ODS that may be causing my issue. &amp;nbsp;Sorry I didn't include this in the original post. Any ideas what may be happening here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*	Output to XML Excel ready format */
ods tagsets.excelxp file="c:\PTH_&amp;amp;QTR._Highs_and_Lows.xml" 
						style=statistical options(orientation='portrait' gridlines='yes' sheet_name="&amp;amp;QTR" embedded_titles='yes');
title j=left "PTH Highs and Lows for Quarter &amp;amp;QTR";
proc print label noobs;
label imb_dlvry_zip_5 = 'ZIP5';
run;
ods tagsets.excelxp close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/13132i86E19C8FCB6DBA5D/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Capture.JPG" title="Capture.JPG" /&gt;</description>
      <pubDate>Fri, 11 Nov 2016 14:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/310990#M67107</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-11-11T14:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: Leading zero of my character string is dropped</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/310994#M67108</link>
      <description>&lt;P&gt;Yes, then this is a well known problem. &amp;nbsp;It is not SAS however, but Excel which trims off leading zeros of numerical data, that is its default behaviour. &amp;nbsp;To get around this you need to tell it, via tags, that it should treat the number as character (you will have seen this with the small gree triangle in the cell):&lt;/P&gt;
&lt;PRE&gt;proc report data=&amp;lt;your dataset&amp;gt; nowd;
  columns _all_;
  define imb_dlvry / "Label for variable" style={tagattr='format:text'};
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Nov 2016 15:00:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/310994#M67108</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-11-11T15:00:37Z</dc:date>
    </item>
    <item>
      <title>Re: Leading zero of my character string is dropped</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/311004#M67109</link>
      <description>&lt;P&gt;Hmm sounds promising, but I must be doing something wrong still.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods tagsets.excelxp file="c:\PTH_&amp;amp;QTR._Highs_and_Lows.xml" 
style=statistical options(orientation='portrait' gridlines='yes' sheet_name="&amp;amp;QTR" embedded_titles='yes');
title j=left "PTH Highs and Lows for Quarter &amp;amp;QTR";
proc print noobs;
columns _all_;
define imb_dlvry_zip_5 / "ZIP5" style={tagattr='format:text'};
run;
ods tagsets.excelxp close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;379 ods tagsets.excelxp file="c:\PTH_&amp;amp;QTR._Highs_and_Lows.xml"&lt;BR /&gt;380 style=statistical options(orientation='portrait' gridlines='yes' sheet_name="&amp;amp;QTR"&lt;BR /&gt;380! embedded_titles='yes');&lt;BR /&gt;NOTE: Writing TAGSETS.EXCELXP Body file: c:\PTH_164_Highs_and_Lows.xml&lt;BR /&gt;NOTE: This is the Excel XP tagset (Compatible with SAS 9.1.3 and above, v1.122, 01/04/2011). Add options(doc='help') to the&lt;BR /&gt;ods statement for more information.&lt;BR /&gt;382 title j=left "PTH Highs and Lows for Quarter &amp;amp;QTR";&lt;BR /&gt;384 proc print noobs;&lt;BR /&gt;385 columns _all_;&lt;BR /&gt; -------&lt;BR /&gt; 180&lt;BR /&gt;386 define imb_dlvry_zip_5 / "ZIP5" style={tagattr='format:text'};&lt;BR /&gt; ------&lt;BR /&gt; 180&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;388 run;&lt;BR /&gt;&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE PRINT used (Total process time):&lt;BR /&gt; real time 0.00 seconds&lt;BR /&gt; user cpu time 0.00 seconds&lt;BR /&gt; system cpu time 0.00 seconds&lt;BR /&gt; memory 564.67k&lt;BR /&gt; OS Memory 21644.00k&lt;BR /&gt; Timestamp 11/11/2016 10:29:58 AM&lt;BR /&gt;&lt;BR /&gt;389 ods tagsets.excelxp close;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2016 15:33:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/311004#M67109</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-11-11T15:33:40Z</dc:date>
    </item>
    <item>
      <title>Re: Leading zero of my character string is dropped</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/311026#M67113</link>
      <description>&lt;P&gt;Look at the difference between your program and mine, particularly the "proc report" versus "proc print" as they have different syntax. &amp;nbsp;Personally I would use report as its more flexible.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2016 17:20:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/311026#M67113</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-11-11T17:20:43Z</dc:date>
    </item>
    <item>
      <title>Re: Leading zero of my character string is dropped</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/311033#M67118</link>
      <description>&lt;P&gt;Thanks so much for the help. I appreciate your time.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Nov 2016 18:17:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Leading-zero-of-my-character-string-is-dropped/m-p/311033#M67118</guid>
      <dc:creator>buechler66</dc:creator>
      <dc:date>2016-11-11T18:17:48Z</dc:date>
    </item>
  </channel>
</rss>

