<?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: Preceeding Zeros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Preceeding-Zeros/m-p/64234#M13986</link>
    <description>What type is DIAG (char or num) ? What you might are looking for is z.&lt;BR /&gt;
&lt;BR /&gt;
Look at the two small examples below:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data test;&lt;BR /&gt;
input DIAG $;&lt;BR /&gt;
num = input(diag,best.);&lt;BR /&gt;
char = put(num,z5.);&lt;BR /&gt;
put _all_;&lt;BR /&gt;
datalines;&lt;BR /&gt;
00345&lt;BR /&gt;
011&lt;BR /&gt;
67893&lt;BR /&gt;
1888&lt;BR /&gt;
;&lt;BR /&gt;
run;[/pre]&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data test;&lt;BR /&gt;
input DIAG;&lt;BR /&gt;
char = put(diag,z5.);&lt;BR /&gt;
put _all_;&lt;BR /&gt;
datalines;&lt;BR /&gt;
00345&lt;BR /&gt;
011&lt;BR /&gt;
67893&lt;BR /&gt;
1888&lt;BR /&gt;
;&lt;BR /&gt;
run;[/pre]</description>
    <pubDate>Wed, 03 Dec 2008 21:42:45 GMT</pubDate>
    <dc:creator>GertNissen</dc:creator>
    <dc:date>2008-12-03T21:42:45Z</dc:date>
    <item>
      <title>Preceeding Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Preceeding-Zeros/m-p/64232#M13984</link>
      <description>What kind of function to use that will result in preceding zeros being  recognized by SAS?  &lt;BR /&gt;
For example, I have diagnosis codes that are given in character format as ('00345', '011' , '67893', '1888' etc.)&lt;BR /&gt;
&lt;BR /&gt;
The following statement appears to read the first  2 codes as '345' and '11':&lt;BR /&gt;
&lt;BR /&gt;
 CC = PUT(LEFT(PUT(DIAG,8.)),$&amp;amp;FMNAME..);&lt;BR /&gt;
&lt;BR /&gt;
What do I need to change?</description>
      <pubDate>Wed, 03 Dec 2008 20:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Preceeding-Zeros/m-p/64232#M13984</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-12-03T20:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Preceeding Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Preceeding-Zeros/m-p/64233#M13985</link>
      <description>Sorry, I can't reproduce your problem. For me CC comes out as 00345 if I use "10" as &amp;amp;FMNAME. Maybe it is the format that is the problem? Perhaps if you output the format to a CNTLOUT table (PROC FORMAT) will give you a hint.&lt;BR /&gt;
If not, try to split up your assignment statement into several using intermediate variables, togehter with a PUT _ALL_;&lt;BR /&gt;
&lt;BR /&gt;
/Linus</description>
      <pubDate>Wed, 03 Dec 2008 20:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Preceeding-Zeros/m-p/64233#M13985</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2008-12-03T20:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: Preceeding Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Preceeding-Zeros/m-p/64234#M13986</link>
      <description>What type is DIAG (char or num) ? What you might are looking for is z.&lt;BR /&gt;
&lt;BR /&gt;
Look at the two small examples below:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data test;&lt;BR /&gt;
input DIAG $;&lt;BR /&gt;
num = input(diag,best.);&lt;BR /&gt;
char = put(num,z5.);&lt;BR /&gt;
put _all_;&lt;BR /&gt;
datalines;&lt;BR /&gt;
00345&lt;BR /&gt;
011&lt;BR /&gt;
67893&lt;BR /&gt;
1888&lt;BR /&gt;
;&lt;BR /&gt;
run;[/pre]&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data test;&lt;BR /&gt;
input DIAG;&lt;BR /&gt;
char = put(diag,z5.);&lt;BR /&gt;
put _all_;&lt;BR /&gt;
datalines;&lt;BR /&gt;
00345&lt;BR /&gt;
011&lt;BR /&gt;
67893&lt;BR /&gt;
1888&lt;BR /&gt;
;&lt;BR /&gt;
run;[/pre]</description>
      <pubDate>Wed, 03 Dec 2008 21:42:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Preceeding-Zeros/m-p/64234#M13986</guid>
      <dc:creator>GertNissen</dc:creator>
      <dc:date>2008-12-03T21:42:45Z</dc:date>
    </item>
    <item>
      <title>Re: Preceeding Zeros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Preceeding-Zeros/m-p/64235#M13987</link>
      <description>Hi Liv&lt;BR /&gt;
&lt;BR /&gt;
What your code shows is that your variable DIAG is actualy numeric. The statement 'PUT(DIAG,8.)' uses the numeric format w.d.&lt;BR /&gt;
&lt;BR /&gt;
The result of this 'put' is a character string without leading zeros. &lt;BR /&gt;
&lt;BR /&gt;
As Geniz demonstrates: If you want leading zeros you have to use the Zw.d format; 'PUT(DIAG,z8.)'&lt;BR /&gt;
&lt;BR /&gt;
No clue how your outer put statement using $&amp;amp;FMNAME.. will digest this string with leading zeros. Does this format expect such a string?&lt;BR /&gt;
&lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Thu, 04 Dec 2008 09:23:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Preceeding-Zeros/m-p/64235#M13987</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2008-12-04T09:23:25Z</dc:date>
    </item>
  </channel>
</rss>

