<?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: import multiple text files with missing values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-files-with-missing-values/m-p/452584#M114248</link>
    <description>wow... Thank you sooooo much. It works now!!&lt;BR /&gt;I was struggling with this whole day T.T&lt;BR /&gt;Thanks a lot!!</description>
    <pubDate>Mon, 09 Apr 2018 17:50:51 GMT</pubDate>
    <dc:creator>medic</dc:creator>
    <dc:date>2018-04-09T17:50:51Z</dc:date>
    <item>
      <title>import multiple text files with missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-files-with-missing-values/m-p/452579#M114246</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;I'm trying to import multiple text files with comma(,) as delimiter, and make it as one dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I refered to the following post and wrote a program as follows:&lt;/P&gt;&lt;P&gt;&lt;A href="https://communities.sas.com/t5/General-SAS-Programming/read-in-multiple-txt-files-in-to-one-SAS-file/td-p/86690" target="_blank"&gt;https://communities.sas.com/t5/General-SAS-Programming/read-in-multiple-txt-files-in-to-one-SAS-file/td-p/86690&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;my program:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename file pipe 'dir D:\test\*.txt /s /b';
data test.t200_test;
	infile file truncover;
	input fname $100.;
	infile in filevar=fname end=last truncover dlm=',' firstobs=1;
	do until(last);
		input A $ B $ C $ D $;
		output;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the problem I'm struggling is that in the data file, there are some missing values such as&lt;/P&gt;&lt;P&gt;123, A01, &lt;SPAN&gt;20180401&lt;/SPAN&gt;, 54321&lt;/P&gt;&lt;P&gt;234, , 20180401, 23412 &amp;nbsp;( &amp;lt;- missing data in the second column )&lt;/P&gt;&lt;P&gt;345, D31, 20180402, 12345&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in this case, the dataset from the code above looks like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　B　　　　　C　　　　　D&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;123&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;A01&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;20180401&lt;SPAN&gt;　&lt;/SPAN&gt;54321&lt;/P&gt;&lt;P&gt;234&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;20180401&lt;SPAN&gt;　 23412&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;345　　D31　　　　20180402　12345&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;which means, the program does not recognize that there's a missing value in second row of the column B, and just enters the value which is supposed to be in column C, and eventually leaving the last column empty.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;But if there's no missing value on the next row, then the data is entered correctly again.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;However, if I don't use this program and manually import the data files one by one using proc import procedure or import wizard, then there's no problem like this and becomes as what it should look like :&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　B　　　　　C　　　　　D&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;123&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;A01&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;20180401&lt;SPAN&gt;　&lt;/SPAN&gt;54321&lt;/P&gt;&lt;P&gt;234&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　.&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　&lt;/SPAN&gt;&lt;SPAN&gt;　 &amp;nbsp; &amp;nbsp; &lt;/SPAN&gt;20180401&lt;SPAN&gt;　23412&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;345　　D31　　　　20180402　12345&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank you in advance for your help!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 17:47:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-files-with-missing-values/m-p/452579#M114246</guid>
      <dc:creator>medic</dc:creator>
      <dc:date>2018-04-09T17:47:05Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text files with missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-files-with-missing-values/m-p/452581#M114247</link>
      <description>&lt;P&gt;Add the DSD option to your INFILE statement?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 17:46:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-files-with-missing-values/m-p/452581#M114247</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-04-09T17:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: import multiple text files with missing values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-files-with-missing-values/m-p/452584#M114248</link>
      <description>wow... Thank you sooooo much. It works now!!&lt;BR /&gt;I was struggling with this whole day T.T&lt;BR /&gt;Thanks a lot!!</description>
      <pubDate>Mon, 09 Apr 2018 17:50:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-multiple-text-files-with-missing-values/m-p/452584#M114248</guid>
      <dc:creator>medic</dc:creator>
      <dc:date>2018-04-09T17:50:51Z</dc:date>
    </item>
  </channel>
</rss>

