<?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: Please help to resolve the infile related. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/440018#M282478</link>
    <description>&lt;P&gt;thank you all dear expert.&lt;/P&gt;&lt;P&gt;I apologies, I miss a condition: the "new line " (enter key) if present I wanted to translate to space (" ") so that it reads in as continues seperated by comma.&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;P&gt;have:&lt;/P&gt;&lt;P&gt;abc,def&lt;BR /&gt;new line,&lt;BR /&gt;ghi,jkl,mno&lt;BR /&gt;,pqr&lt;BR /&gt;stuw,xyz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;want:&lt;/P&gt;&lt;P&gt;abc&lt;/P&gt;&lt;P&gt;def new line&lt;BR /&gt;ghi&lt;/P&gt;&lt;P&gt;jkl&lt;/P&gt;&lt;P&gt;mno&lt;BR /&gt;pqr stuw&lt;/P&gt;&lt;P&gt;xyz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 25 Feb 2018 10:48:33 GMT</pubDate>
    <dc:creator>Tomtak1234</dc:creator>
    <dc:date>2018-02-25T10:48:33Z</dc:date>
    <item>
      <title>Please help to resolve the infile related.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/439929#M282474</link>
      <description>&lt;P&gt;I have the text file which is not uniform. I want to read in one variable in continues, which is separated by comma. Like below. Thanks for help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;have input:&lt;BR /&gt;abc,def,&lt;BR /&gt;ghi,jkl,mno&lt;BR /&gt;,pqr stuw,xyz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;want ouput:&lt;BR /&gt;abc&lt;BR /&gt;def&lt;BR /&gt;ghi&lt;BR /&gt;jkl&lt;BR /&gt;mno&lt;BR /&gt;pqr stuw&lt;/P&gt;&lt;P&gt;xyz&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2018 08:17:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/439929#M282474</guid>
      <dc:creator>Tomtak1234</dc:creator>
      <dc:date>2018-02-24T08:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: Please help to resolve the infile related.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/439930#M282475</link>
      <description>&lt;P&gt;you need to use double trailing&amp;nbsp;@@&amp;nbsp;&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 want;
 informat var $20.;
 infile datalines dsd ;
 input var $ @@;
 if var = ' ' then delete;
 datalines;
abc,def,
ghi,jkl,mno
,pqr stuw,xyz
,hhhhhhhhhhhhhhhh,yyy
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2018 08:35:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/439930#M282475</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-02-24T08:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: Please help to resolve the infile related.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/439947#M282476</link>
      <description>&lt;P&gt;thank you kiranV_. it works..&lt;/P&gt;</description>
      <pubDate>Sat, 24 Feb 2018 15:11:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/439947#M282476</guid>
      <dc:creator>Tomtak1234</dc:creator>
      <dc:date>2018-02-24T15:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Please help to resolve the infile related.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/439966#M282477</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*with single trailing*/
data have1;
infile datalines dsd truncover;
input var :$20. @;
do _n_=1 by 1 until(_n_ eq countw(_infile_,',','M'));
if not missing(var) then output;
input var : $20. @;
end;
datalines;
abc,def,
ghi,jkl,mno
,pqr stuw,xyz
;

/*with scan*/
data have2;
infile datalines dsd truncover;
input @;
do _n_=1 to countw(_infile_,',');
var=scan(_infile_,_n_,',');
if not missing(var) then output;
end;
datalines;
abc,def,
ghi,jkl,mno
,pqr stuw,xyz
;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 24 Feb 2018 19:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/439966#M282477</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2018-02-24T19:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Please help to resolve the infile related.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/440018#M282478</link>
      <description>&lt;P&gt;thank you all dear expert.&lt;/P&gt;&lt;P&gt;I apologies, I miss a condition: the "new line " (enter key) if present I wanted to translate to space (" ") so that it reads in as continues seperated by comma.&lt;/P&gt;&lt;P&gt;for example:&lt;/P&gt;&lt;P&gt;have:&lt;/P&gt;&lt;P&gt;abc,def&lt;BR /&gt;new line,&lt;BR /&gt;ghi,jkl,mno&lt;BR /&gt;,pqr&lt;BR /&gt;stuw,xyz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;want:&lt;/P&gt;&lt;P&gt;abc&lt;/P&gt;&lt;P&gt;def new line&lt;BR /&gt;ghi&lt;/P&gt;&lt;P&gt;jkl&lt;/P&gt;&lt;P&gt;mno&lt;BR /&gt;pqr stuw&lt;/P&gt;&lt;P&gt;xyz&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2018 10:48:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/440018#M282478</guid>
      <dc:creator>Tomtak1234</dc:creator>
      <dc:date>2018-02-25T10:48:33Z</dc:date>
    </item>
    <item>
      <title>Re: Please help to resolve the infile related.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/440035#M282479</link>
      <description>&lt;P&gt;this might work.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data want;
 informat var $20.;
 infile datalines dsd ;
 input var $ @@;
 datalines;
abc,def,
ghi,jkl,mno
,pqr stuw,xyz
,hhhhhhhhhhhhhhhh,yyy
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Feb 2018 15:50:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/440035#M282479</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-02-25T15:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Please help to resolve the infile related.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/440038#M282480</link>
      <description>&lt;P&gt;So if you have the data in a file then read it using RECFM=N and manually remove or replace the &lt;SPAN&gt;end of line characters&lt;/SPAN&gt;.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will need to know what &lt;SPAN&gt;end of line characters&lt;/SPAN&gt; your file is using.&amp;nbsp; Normally it is either CR+LF (Windows/DOS) or LF (Unix).&lt;/P&gt;
&lt;P&gt;Let's put your example data into a file with CR+LF as the end of line characters.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename sample temp;
data _null_;
  file sample termstr=CRLF;
  put
 'abc,def'
/'new line,'
/'ghi,jkl,mno'
/',pqr'
/'stuw,xyz'
 ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Now let's read it in.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  length word $100 ;
  infile sample dsd recfm=n ;
  input word ;
  if word=:'0D0A'x then word=substr(word,3);
  word = tranwrd(word,'0D0A'x,' ');
  put _n_= word= :$quote.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results.&lt;/P&gt;
&lt;PRE&gt;_N_=1 word="abc"
_N_=2 word="def new line"
_N_=3 word="ghi"
_N_=4 word="jkl"
_N_=5 word="mno"
_N_=6 word="pqr stuw"
_N_=7 word="xyz"&lt;/PRE&gt;</description>
      <pubDate>Sun, 25 Feb 2018 17:11:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/440038#M282480</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-02-25T17:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: Please help to resolve the infile related.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/440058#M282481</link>
      <description>&lt;P&gt;thank you Tom. I got the expected. and learn many thing from experts.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Feb 2018 18:54:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Please-help-to-resolve-the-infile-related/m-p/440058#M282481</guid>
      <dc:creator>Tomtak1234</dc:creator>
      <dc:date>2018-02-25T18:54:02Z</dc:date>
    </item>
  </channel>
</rss>

