<?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 Importing a delimited text file with varying-length character variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-delimited-text-file-with-varying-length-character/m-p/938738#M368682</link>
    <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;I am trying to import a "|" delimited text file without much success. The data set has many character variables of variable length. I am not getting any error messages, but SAS reads many variables in correctly. The SAS code, input file and output data set are shown below. Any help will be greatly appreciated.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.IMPORT;
	infile "/home/c.eroglu/fec/k.txt" delimiter = '|' firstobs=1 missover;
	input	cmte_id			$ /* max length = 9   */ 
			amndt_ind		$ /* max length = 1   */
			rpt_tp			$ /* max length = 3   */
			transaction_pgi	$ /* max length = 5   */
			image_num		$ /* max length = 18  */
			transaction_tp	$ /* max length = 3   */
			entity_tp		$ /* max length = 3   */
			name			$ /* max length = 200 */
			city			$ /* max length = 30  */
			state			$ /* max length = 2   */
			zip_code		$ /* max length = 9   */
			employer		$ /* max length = 38  */
			occupation		$ /* max length = 38  */
			transaction_dt	$ /* max length = 8   */
			transaction_amt	 
			other_id		$ /* max length = 9   */
			tran_id			$ /* max length = 12  */
			file_num		
			memo_cd			$ /* max length = 1   */
			memo_text		$ /* max length = 100 */
			sub_id			;
 run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cuneyt_0-1723158908270.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99144i09C5E5970D8204C7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Cuneyt_0-1723158908270.png" alt="Cuneyt_0-1723158908270.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2024 23:16:44 GMT</pubDate>
    <dc:creator>Cuneyt</dc:creator>
    <dc:date>2024-08-08T23:16:44Z</dc:date>
    <item>
      <title>Importing a delimited text file with varying-length character variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-delimited-text-file-with-varying-length-character/m-p/938738#M368682</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;I am trying to import a "|" delimited text file without much success. The data set has many character variables of variable length. I am not getting any error messages, but SAS reads many variables in correctly. The SAS code, input file and output data set are shown below. Any help will be greatly appreciated.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.IMPORT;
	infile "/home/c.eroglu/fec/k.txt" delimiter = '|' firstobs=1 missover;
	input	cmte_id			$ /* max length = 9   */ 
			amndt_ind		$ /* max length = 1   */
			rpt_tp			$ /* max length = 3   */
			transaction_pgi	$ /* max length = 5   */
			image_num		$ /* max length = 18  */
			transaction_tp	$ /* max length = 3   */
			entity_tp		$ /* max length = 3   */
			name			$ /* max length = 200 */
			city			$ /* max length = 30  */
			state			$ /* max length = 2   */
			zip_code		$ /* max length = 9   */
			employer		$ /* max length = 38  */
			occupation		$ /* max length = 38  */
			transaction_dt	$ /* max length = 8   */
			transaction_amt	 
			other_id		$ /* max length = 9   */
			tran_id			$ /* max length = 12  */
			file_num		
			memo_cd			$ /* max length = 1   */
			memo_text		$ /* max length = 100 */
			sub_id			;
 run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cuneyt_0-1723158908270.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99144i09C5E5970D8204C7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Cuneyt_0-1723158908270.png" alt="Cuneyt_0-1723158908270.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 23:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-delimited-text-file-with-varying-length-character/m-p/938738#M368682</guid>
      <dc:creator>Cuneyt</dc:creator>
      <dc:date>2024-08-08T23:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a delimited text file with varying-length character variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-delimited-text-file-with-varying-length-character/m-p/938739#M368683</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.IMPORT;
	infile "c:\temp\k.txt" delimiter = '|' dsd truncover;
	input	cmte_id			$ /* max length = 9   */ 
			amndt_ind		$ /* max length = 1   */
			rpt_tp			$ /* max length = 3   */
			transaction_pgi	$ /* max length = 5   */
			image_num		$ /* max length = 18  */
			transaction_tp	$ /* max length = 3   */
			entity_tp		$ /* max length = 3   */
			name			$ /* max length = 200 */
			city			$ /* max length = 30  */
			state			$ /* max length = 2   */
			zip_code		$ /* max length = 9   */
			employer		$ /* max length = 38  */
			occupation		$ /* max length = 38  */
			transaction_dt	$ /* max length = 8   */
			transaction_amt	 
			other_id		$ /* max length = 9   */
			tran_id			$ /* max length = 12  */
			file_num		
			memo_cd			$ /* max length = 1   */
			memo_text		$ /* max length = 100 */
			sub_id			;
 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Aug 2024 00:51:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-delimited-text-file-with-varying-length-character/m-p/938739#M368683</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2024-08-09T00:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Importing a delimited text file with varying-length character variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-a-delimited-text-file-with-varying-length-character/m-p/938740#M368684</link>
      <description>&lt;P&gt;Here is the solution that worked for me:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.IMPORT;
    infile "/home/c.eroglu/fec/k.txt" delimiter = '|' firstobs=1 missover dsd;
    length cmte_id          $9. 
            amndt_ind       $1. 
            rpt_tp          $3. 
            transaction_pgi $5. 
            image_num       $18.
            transaction_tp  $3. 
            entity_tp       $3. 
            name            $200. 
            city            $30. 
            state           $2. 
            zip_code        $9. 
            employer        $38.
            occupation      $38.
            transaction_dt  $8. 
            transaction_amt  8.
            other_id        $9. 
            tran_id         $12. 
            file_num        $22.
            memo_cd         $1.  
            memo_text       $100.
            sub_id          $19.;
           
           
           
    input cmte_id           $ 
            amndt_ind       $ 
            rpt_tp          $ 
            transaction_pgi $ 
            image_num       $ 
            transaction_tp  $ 
            entity_tp       $ 
            name            $ 
            city            $ 
            state           $ 
            zip_code        $ 
            employer        $ 
            occupation      $ 
            transaction_dt  $ 
            transaction_amt  
            other_id        $ 
            tran_id         $ 
            file_num        $
            memo_cd         $ 
            memo_text       $ 
            sub_id          $;
 run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Aug 2024 01:17:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-a-delimited-text-file-with-varying-length-character/m-p/938740#M368684</guid>
      <dc:creator>Cuneyt</dc:creator>
      <dc:date>2024-08-09T01:17:27Z</dc:date>
    </item>
  </channel>
</rss>

