<?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: Proc import txt or excel files to make sure i have the leading zeros in the sas data tables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-txt-or-excel-files-to-make-sure-i-have-the-leading/m-p/745771#M233844</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Or try option guessingrows= :&lt;BR /&gt;&lt;BR /&gt;proc import datafile="\\somedrive\test.txt"&lt;BR /&gt;out=master&lt;BR /&gt;dbms=tab&lt;BR /&gt;replace&lt;BR /&gt;;&lt;BR /&gt;guessingrows=max;&lt;BR /&gt;run;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That will not make any difference for this problem.&amp;nbsp; PROC IMPORT will decide the variable is numeric if the only values it sees in the column are digit strings.&amp;nbsp; It is NOT smart enough to attach the Z format to the numeric variable.&lt;/P&gt;</description>
    <pubDate>Fri, 04 Jun 2021 12:44:25 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2021-06-04T12:44:25Z</dc:date>
    <item>
      <title>Proc import txt or excel files to make sure i have the leading zeros in the sas data tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-txt-or-excel-files-to-make-sure-i-have-the-leading/m-p/745603#M233753</link>
      <description>&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;Below is sample code I am using. Information was replaced with an arbitrary information just for privacy reasons.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;when I import the text file that has rows of numbers that have leading zeros in sas, I get the information with the leading zeros dropped in the master datatable in sas. how do I make sure I maintain the leading zeros when I import the data&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt;&lt;/FONT&gt; &lt;STRONG&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;import&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="2" color="#0000ff"&gt;datafile&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=&lt;/FONT&gt;&lt;FONT face="Courier New" size="2" color="#800080"&gt;"\\somedrive\test.txt"&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;out&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=master&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#0000ff"&gt;dbms&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;=dlm&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;replace&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2" color="#000080"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the test.txt file has these social security numbers listed in rows&lt;/P&gt;&lt;P&gt;000111111&lt;/P&gt;&lt;P&gt;222222222&lt;/P&gt;&lt;P&gt;044444444&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 19:47:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-import-txt-or-excel-files-to-make-sure-i-have-the-leading/m-p/745603#M233753</guid>
      <dc:creator>kmin87</dc:creator>
      <dc:date>2021-06-03T19:47:35Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import txt or excel files to make sure i have the leading zeros in the sas data tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-txt-or-excel-files-to-make-sure-i-have-the-leading/m-p/745608#M233756</link>
      <description>&lt;P&gt;Don't use PROC IMPORT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could try modifying the code that PROC IMPORT generates (but it generates really ugly SAS code). It is usually better (and often faster) to just write your own code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data master;
  infile "\\somedrive\test.txt" dsd truncover firstobs=1;
  input ssn $9. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 20:08:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-import-txt-or-excel-files-to-make-sure-i-have-the-leading/m-p/745608#M233756</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-03T20:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import txt or excel files to make sure i have the leading zeros in the sas data tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-txt-or-excel-files-to-make-sure-i-have-the-leading/m-p/745618#M233764</link>
      <description>&lt;P&gt;Hi &lt;A class="trigger-hovercard" style="color: #007dc3;" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/376137" target="_blank" rel="noopener"&gt;kmin87&lt;/A&gt;,&lt;/P&gt;
&lt;P&gt;Yes, you can either make them type of character (e.g. using $9. informat as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; suggested), or if you keep it numeric, you can also define FORMAT SSN z9 (which will show leading zero even when the number is stored without them).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another way to deal with SSNs is to store them as NUMERIC values and apply FORMAT SSN11. (in the latter case, formatted values will show as NNN-NN-NNNN, that is with hyphens).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 20:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-import-txt-or-excel-files-to-make-sure-i-have-the-leading/m-p/745618#M233764</guid>
      <dc:creator>LeonidBatkhan</dc:creator>
      <dc:date>2021-06-03T20:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import txt or excel files to make sure i have the leading zeros in the sas data tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-txt-or-excel-files-to-make-sure-i-have-the-leading/m-p/745768#M233843</link>
      <description>Or try option guessingrows= :&lt;BR /&gt;&lt;BR /&gt;proc import datafile="\\somedrive\test.txt"&lt;BR /&gt;out=master&lt;BR /&gt;dbms=tab&lt;BR /&gt;replace&lt;BR /&gt;;&lt;BR /&gt;guessingrows=max;&lt;BR /&gt;run;</description>
      <pubDate>Fri, 04 Jun 2021 12:41:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-import-txt-or-excel-files-to-make-sure-i-have-the-leading/m-p/745768#M233843</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-06-04T12:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Proc import txt or excel files to make sure i have the leading zeros in the sas data tables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-import-txt-or-excel-files-to-make-sure-i-have-the-leading/m-p/745771#M233844</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Or try option guessingrows= :&lt;BR /&gt;&lt;BR /&gt;proc import datafile="\\somedrive\test.txt"&lt;BR /&gt;out=master&lt;BR /&gt;dbms=tab&lt;BR /&gt;replace&lt;BR /&gt;;&lt;BR /&gt;guessingrows=max;&lt;BR /&gt;run;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That will not make any difference for this problem.&amp;nbsp; PROC IMPORT will decide the variable is numeric if the only values it sees in the column are digit strings.&amp;nbsp; It is NOT smart enough to attach the Z format to the numeric variable.&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 12:44:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-import-txt-or-excel-files-to-make-sure-i-have-the-leading/m-p/745771#M233844</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-06-04T12:44:25Z</dc:date>
    </item>
  </channel>
</rss>

