<?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 Retaining leading zero in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Retaining-leading-zero/m-p/39023#M10033</link>
    <description>Hello, I'm trying to create a date stamp in SAS from an inputted variable, but I'm having a problem when truncating year from 4 digits to 2 digits.  SAS is dropping the leading zero.&lt;BR /&gt;
&lt;BR /&gt;
For example;&lt;BR /&gt;
&lt;BR /&gt;
month = 01&lt;BR /&gt;
day = 15&lt;BR /&gt;
year = 2009&lt;BR /&gt;
&lt;BR /&gt;
Trying to create the date stamp it currently appears as 1159 instead of 011509 (which is what is needed).&lt;BR /&gt;
&lt;BR /&gt;
If I need to supply more information, please let me know.  Any help would be greatly appreciated.</description>
    <pubDate>Mon, 11 Jan 2010 21:10:30 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-01-11T21:10:30Z</dc:date>
    <item>
      <title>Retaining leading zero</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retaining-leading-zero/m-p/39023#M10033</link>
      <description>Hello, I'm trying to create a date stamp in SAS from an inputted variable, but I'm having a problem when truncating year from 4 digits to 2 digits.  SAS is dropping the leading zero.&lt;BR /&gt;
&lt;BR /&gt;
For example;&lt;BR /&gt;
&lt;BR /&gt;
month = 01&lt;BR /&gt;
day = 15&lt;BR /&gt;
year = 2009&lt;BR /&gt;
&lt;BR /&gt;
Trying to create the date stamp it currently appears as 1159 instead of 011509 (which is what is needed).&lt;BR /&gt;
&lt;BR /&gt;
If I need to supply more information, please let me know.  Any help would be greatly appreciated.</description>
      <pubDate>Mon, 11 Jan 2010 21:10:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retaining-leading-zero/m-p/39023#M10033</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-01-11T21:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: Retaining leading zero</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retaining-leading-zero/m-p/39024#M10034</link>
      <description>Suggest you share the code that generates the SAS variable - the reason is because you have not identified what output format you are using, nor whether you are already converting a SAS "numeric type" DATE variable to character, by using a PUT function.&lt;BR /&gt;
&lt;BR /&gt;
Suggest also having a look at the PROC FORMAT documentation and particularly the use of a "custom date format" with PICTURE.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;BR /&gt;
&lt;BR /&gt;
SAS Procedures Guide, PICTURE Statement&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473467.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/proc/61895/HTML/default/a002473467.htm&lt;/A&gt;</description>
      <pubDate>Mon, 11 Jan 2010 22:22:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retaining-leading-zero/m-p/39024#M10034</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-01-11T22:22:20Z</dc:date>
    </item>
    <item>
      <title>Re: Retaining leading zero</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retaining-leading-zero/m-p/39025#M10035</link>
      <description>You are probably converting numerics to alphas without specifying a leading zero format.&lt;BR /&gt;
[pre]&lt;BR /&gt;
data _null_;&lt;BR /&gt;
&lt;BR /&gt;
DT='15JAN2009'd;&lt;BR /&gt;
&lt;BR /&gt;
* explicit conversion, no leading zero format;&lt;BR /&gt;
M=put(month(DT),2.);&lt;BR /&gt;
D=put(day(DT),2.);&lt;BR /&gt;
Y=put(mod(year(DT),100),2.);&lt;BR /&gt;
X=cats(M,D,Y);&lt;BR /&gt;
put _all_; * wrong;&lt;BR /&gt;
&lt;BR /&gt;
* implicit conversion, no format at all;&lt;BR /&gt;
M=month(DT);&lt;BR /&gt;
D=day(DT);&lt;BR /&gt;
Y=mod(year(DT),100);&lt;BR /&gt;
X=cats(M,D,Y);&lt;BR /&gt;
put _all_; * wrong;&lt;BR /&gt;
&lt;BR /&gt;
* explicit conversion, with leading zero format;&lt;BR /&gt;
M=put(month(DT),z2.);&lt;BR /&gt;
D=put(day(DT),z2.);&lt;BR /&gt;
Y=put(mod(year(DT),100),z2.);&lt;BR /&gt;
X=cats(M,D,Y);&lt;BR /&gt;
put _all_; * right!;&lt;BR /&gt;
&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
But, that's only an assumption.&lt;BR /&gt;
&lt;BR /&gt;
Help us to help you. As said above, you should always share you're code.&lt;BR /&gt;
&lt;BR /&gt;
Cheers from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos @ &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Tue, 12 Jan 2010 08:34:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retaining-leading-zero/m-p/39025#M10035</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2010-01-12T08:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: Retaining leading zero</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retaining-leading-zero/m-p/39026#M10036</link>
      <description>"always" convert date data to SAS/Date.  Then you can display with any format.  The one you want is built in.&lt;BR /&gt;
[pre]&lt;BR /&gt;
359  data _null_;&lt;BR /&gt;
360&lt;BR /&gt;
361     month = 01;&lt;BR /&gt;
362     day = 15;&lt;BR /&gt;
363     year = 2009;&lt;BR /&gt;
364&lt;BR /&gt;
365     date = mdy(month,day,year);&lt;BR /&gt;
366&lt;BR /&gt;
367     put 'STAMP: ' date mmddyyN6.;&lt;BR /&gt;
368     run;&lt;BR /&gt;
&lt;BR /&gt;
STAMP: 011509&lt;BR /&gt;
[/pre]

Message was edited by: data _null_;</description>
      <pubDate>Tue, 12 Jan 2010 12:35:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retaining-leading-zero/m-p/39026#M10036</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-01-12T12:35:45Z</dc:date>
    </item>
  </channel>
</rss>

