<?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: How to read this pipe separated data. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-this-pipe-separated-data/m-p/285504#M311522</link>
    <description>&lt;P&gt;Why do you have two delimiters at each data item? &amp;nbsp;That's no longer a delimeted file. &amp;nbsp;Personally I would reject the file, and get the sender to provide a proper delimited file (i.e. data items separated by one character). &amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you have is going to make it quite hard to read in. &amp;nbsp;For instance the first line shows 8 variables, but the first data line:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;AA||||12||||||15||||||20||||||25||||00||||X||||||1&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Shows 7 data points, which one should be blank? &amp;nbsp;Is age 12 or missing? &amp;nbsp;Its a bit of a mess, and the responsibility of the file provider to sort it out.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Jul 2016 12:35:55 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-07-19T12:35:55Z</dc:date>
    <item>
      <title>How to read this pipe separated data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-this-pipe-separated-data/m-p/285503#M311521</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;Please find the&amp;nbsp;below sample data which&amp;nbsp;is separated by pipe symbol(|).&lt;/P&gt;
&lt;P&gt;i am not able to read this file.please help me in importing/reading the file.&lt;/P&gt;
&lt;P&gt;regards,&lt;/P&gt;
&lt;P&gt;karthik&lt;/P&gt;
&lt;P&gt;/****************************samp.txt**************************************************/&lt;/P&gt;
&lt;P&gt;NAME||AGE||SCORE_ENG||SCORE_ECO||SCORE_STAT||ROLL_NO||CLASS||RANK&lt;BR /&gt;AA||||12||||||15||||||20||||||25||||00||||X||||||1&lt;BR /&gt;BBB||||14||||||12||||||13||||||22||||01||||X||||||1&lt;BR /&gt;CC||||16||||||12||||||11||||||23||||02||||IX||||||1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;DD||||18||||||13||||||16||||||25||||03||||XI||||||1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;EEE||||13||||||14||||||14||||||05||||04||||X||||||1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;FFFFF||||17||||||16||||||16||||||14||||05||||XII||||||1&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 12:23:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-this-pipe-separated-data/m-p/285503#M311521</guid>
      <dc:creator>Chikku</dc:creator>
      <dc:date>2016-07-19T12:23:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to read this pipe separated data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-this-pipe-separated-data/m-p/285504#M311522</link>
      <description>&lt;P&gt;Why do you have two delimiters at each data item? &amp;nbsp;That's no longer a delimeted file. &amp;nbsp;Personally I would reject the file, and get the sender to provide a proper delimited file (i.e. data items separated by one character). &amp;nbsp;&lt;/P&gt;
&lt;P&gt;What you have is going to make it quite hard to read in. &amp;nbsp;For instance the first line shows 8 variables, but the first data line:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;AA||||12||||||15||||||20||||||25||||00||||X||||||1&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Shows 7 data points, which one should be blank? &amp;nbsp;Is age 12 or missing? &amp;nbsp;Its a bit of a mess, and the responsibility of the file provider to sort it out.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Jul 2016 12:35:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-this-pipe-separated-data/m-p/285504#M311522</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-07-19T12:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to read this pipe separated data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-this-pipe-separated-data/m-p/285505#M311523</link>
      <description>&lt;P&gt;Looks like someone took a regular file and converted all of the spaces into two pipe characters.&lt;/P&gt;
&lt;P&gt;Try using DLM='|' but without the DSD option.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check;
  infile cards dlm='|' truncover ;
  length x1-x10 $50;
  input x1-x10;
cards;
NAME||AGE||SCORE_ENG||SCORE_ECO||SCORE_STAT||ROLL_NO||CLASS||RANK
AA||||12||||||15||||||20||||||25||||00||||X||||||1
BBB||||14||||||12||||||13||||||22||||01||||X||||||1
CC||||16||||||12||||||11||||||23||||02||||IX||||||1
DD||||18||||||13||||||16||||||25||||03||||XI||||||1
EEE||||13||||||14||||||14||||||05||||04||||X||||||1
FFFFF||||17||||||16||||||16||||||14||||05||||XII||||||1
;
proc print; run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Jul 2016 12:44:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-this-pipe-separated-data/m-p/285505#M311523</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-07-19T12:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to read this pipe separated data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-this-pipe-separated-data/m-p/285709#M311524</link>
      <description>&lt;P&gt;Delimiter is double pipe . You need TRANWRD() function .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data check;
  infile cards dlm='|' dsd truncover;
  input @;
  _infile_=tranwrd(_infile_,'||','|'); put _infile_;
  input (x1-x20) (:$10.);
cards;
NAME||AGE||SCORE_ENG||SCORE_ECO||SCORE_STAT||ROLL_NO||CLASS||RANK
AA||||12||||||15||||||20||||||25||||00||||X||||||1
BBB||||14||||||12||||||13||||||22||||01||||X||||||1
CC||||16||||||12||||||11||||||23||||02||||IX||||||1
DD||||18||||||13||||||16||||||25||||03||||XI||||||1
EEE||||13||||||14||||||14||||||05||||04||||X||||||1
FFFFF||||17||||||16||||||16||||||14||||05||||XII||||||1
;
proc print; run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 20 Jul 2016 02:12:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-this-pipe-separated-data/m-p/285709#M311524</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-07-20T02:12:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to read this pipe separated data.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-read-this-pipe-separated-data/m-p/285835#M311526</link>
      <description>&lt;P&gt;This works for me on my machine with your text file:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename t "d:\data\test.txt";

data junk;
   infile t dlmstr="||"  firstobs=2;
   informat name $5. age score_eng score_eco score_stat best8. roll_no class $4. rank $8.;
   input  name  age score_eng score_eco score_stat roll_no class rank ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;STRONG&gt;However,&lt;/STRONG&gt; you have a bunch of TABS at the end of the lines for Class IX XI and X, different numbers of tabs. Which is why I'm reading Rank as a string. It fails as a number because with the "delimiter" being "||" it attempts to read those tabs at the end as part of the value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jul 2016 14:48:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-read-this-pipe-separated-data/m-p/285835#M311526</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-07-20T14:48:05Z</dc:date>
    </item>
  </channel>
</rss>

