<?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: Reading variables with preceeding zeros in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386931#M24946</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37783"&gt;@kiranv_&lt;/a&gt; you need to supply something that tells SAS the necessary lengths, otherwise the character variables will default to length $8.&lt;/P&gt;</description>
    <pubDate>Thu, 10 Aug 2017 10:42:54 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2017-08-10T10:42:54Z</dc:date>
    <item>
      <title>Reading variables with preceeding zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386927#M24943</link>
      <description>&lt;P&gt;Hi Everyone. This might be a simple one, but still, I need to read some data into sas with preceeding zeros as mentioned below: the variables Id and status are character datatype. remaining variables are numeric.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data games;&lt;BR /&gt;input nbr1 nbr2 id constant status;&lt;BR /&gt;datalines;&lt;/P&gt;&lt;P&gt;013 1297 00000063031560224013 1655003 01&lt;BR /&gt;013 1484 00000050031560254205 1655003 01&lt;BR /&gt;013 1297 00000040031560224013 1655003 01&lt;BR /&gt;013 1484 00000060031560254205 1655003 00&lt;/P&gt;&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Thanu&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386927#M24943</guid>
      <dc:creator>Thanu</dc:creator>
      <dc:date>2017-08-10T10:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Reading variables with preceeding zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386929#M24944</link>
      <description>&lt;P&gt;You just need to add $ after you mention id and status as shown below. $ implies character variable and absence of it as numeric&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data games;&lt;BR /&gt;input nbr1 nbr2 id $ constant status $;&lt;BR /&gt;datalines;&lt;/P&gt;
&lt;P&gt;013 1297 00000063031560224013 1655003 01&lt;BR /&gt;013 1484 00000050031560254205 1655003 01&lt;BR /&gt;013 1297 00000040031560224013 1655003 01&lt;BR /&gt;013 1484 00000060031560254205 1655003 00&lt;/P&gt;
&lt;P&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:40:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386929#M24944</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-08-10T10:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reading variables with preceeding zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386930#M24945</link>
      <description>&lt;P&gt;Just add informats:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data games;
input nbr1 nbr2 id :$20. constant status :$2.;
datalines;
013 1297 00000063031560224013 1655003 01
013 1484 00000050031560254205 1655003 01
013 1297 00000040031560224013 1655003 01
013 1484 00000060031560254205 1655003 00
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The colon prevents SAS from using "true" formatted input that would disregard the delimiters.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:41:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386930#M24945</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-10T10:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reading variables with preceeding zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386931#M24946</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37783"&gt;@kiranv_&lt;/a&gt; you need to supply something that tells SAS the necessary lengths, otherwise the character variables will default to length $8.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:42:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386931#M24946</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-10T10:42:54Z</dc:date>
    </item>
    <item>
      <title>Re: Reading variables with preceeding zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386932#M24947</link>
      <description>&lt;P&gt;Can you clarify what the output should be? &amp;nbsp;You say ID is character, but in your example you read it in as number? &amp;nbsp;If you want to display a number with preceeding zeroes then:&lt;/P&gt;
&lt;PRE&gt;data games;
  input nbr1 nbr2 id constant status;
  format id z20. status z2.;
datalines;
013 1297 00000063031560224013 1655003 01
013 1484 00000050031560254205 1655003 01
013 1297 00000040031560224013 1655003 01
013 1484 00000060031560254205 1655003 00
;
run;&lt;/PRE&gt;
&lt;P&gt;If you just want ID to be character then read it as character:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;PRE&gt;data games;
  length id $200;
  input nbr1 nbr2 id $ constant status;
datalines;
013 1297 00000063031560224013 1655003 01
013 1484 00000050031560254205 1655003 01
013 1297 00000040031560224013 1655003 01
013 1484 00000060031560254205 1655003 00
;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:43:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386932#M24947</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-08-10T10:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: Reading variables with preceeding zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386933#M24948</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&amp;nbsp;You are so right and thanks for correcting me.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386933#M24948</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-08-10T10:44:25Z</dc:date>
    </item>
    <item>
      <title>Re: Reading variables with preceeding zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386935#M24949</link>
      <description>&lt;P&gt;Yet, the&amp;nbsp;Zero for the first variable (nbr1) is getting truncated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:44:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386935#M24949</guid>
      <dc:creator>Thanu</dc:creator>
      <dc:date>2017-08-10T10:44:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reading variables with preceeding zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386936#M24950</link>
      <description>&lt;P&gt;ID variable&amp;nbsp;should be a character. When running the&amp;nbsp;2nd code you posted, the&amp;nbsp;zeros are getting truncated in the&amp;nbsp;first variable (nbr1) it shows only 13 instead of 013&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:47:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386936#M24950</guid>
      <dc:creator>Thanu</dc:creator>
      <dc:date>2017-08-10T10:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Reading variables with preceeding zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386946#M24951</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/113111"&gt;@Thanu&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Yet, the&amp;nbsp;Zero for the first variable (nbr1) is getting truncated.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That's perfectly OK, because it is numeric (as you said). If you want it to &lt;EM&gt;display&lt;/EM&gt; with leading series, assign it a proper Zw. format.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386946#M24951</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-10T10:54:02Z</dc:date>
    </item>
    <item>
      <title>Re: Reading variables with preceeding zeros</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386947#M24952</link>
      <description>&lt;P&gt;On the input line, $ indicates that the variable should be read as character no dollar means numeric. &amp;nbsp;Numeric values&amp;nbsp;&lt;STRONG&gt;do not&amp;nbsp;&lt;/STRONG&gt; contain preceeding zeroes, only by applying the Zx. format can you do this, or by changing to character:&lt;/P&gt;
&lt;PRE&gt;data games;
  length id $200;
  input nbr1 $ nbr2 id $ constant status;
datalines;
013 1297 00000063031560224013 1655003 01
013 1484 00000050031560254205 1655003 01
013 1297 00000040031560224013 1655003 01
013 1484 00000060031560254205 1655003 00
;
run;&lt;/PRE&gt;</description>
      <pubDate>Thu, 10 Aug 2017 10:58:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reading-variables-with-preceeding-zeros/m-p/386947#M24952</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-08-10T10:58:55Z</dc:date>
    </item>
  </channel>
</rss>

