<?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: input methods in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328862#M73484</link>
    <description>&lt;P&gt;if dataline contanins huge amount of lines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there any way to do so or not?&lt;/P&gt;</description>
    <pubDate>Tue, 31 Jan 2017 20:36:23 GMT</pubDate>
    <dc:creator>Garik</dc:creator>
    <dc:date>2017-01-31T20:36:23Z</dc:date>
    <item>
      <title>input methods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328858#M73482</link>
      <description>&lt;P&gt;Hi, there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have such question.&lt;/P&gt;&lt;P&gt;If I have sas code as is below and the result should be as shown at the end, what to write instead of the question marks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data input_method;&lt;/P&gt;&lt;P&gt;input &amp;nbsp;GG$ &amp;nbsp; &amp;nbsp;HH$ &amp;nbsp; &amp;nbsp;&lt;FONT face="arial black,avant garde" color="#FF0000"&gt; ????????????????&lt;/FONT&gt;;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;datalines;&lt;BR /&gt;G A R I K&lt;BR /&gt;H A K O B Y A N&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;////////////////////////////////////////////////////&lt;/P&gt;&lt;P&gt;GG&amp;nbsp; HH&lt;/P&gt;&lt;P&gt;G &amp;nbsp; H&lt;/P&gt;&lt;P&gt;A &amp;nbsp; &amp;nbsp;A&lt;/P&gt;&lt;P&gt;R &amp;nbsp; K&lt;/P&gt;&lt;P&gt;I &amp;nbsp; &amp;nbsp;O&amp;nbsp;&lt;/P&gt;&lt;P&gt;K &amp;nbsp; B&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Y&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;A&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;N&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 20:01:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328858#M73482</guid>
      <dc:creator>Garik</dc:creator>
      <dc:date>2017-01-31T20:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: input methods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328859#M73483</link>
      <description>&lt;P&gt;The datalines need to be written in the same way as the intended result. That's quite obvious, isn't it?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 20:26:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328859#M73483</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-01-31T20:26:07Z</dc:date>
    </item>
    <item>
      <title>Re: input methods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328862#M73484</link>
      <description>&lt;P&gt;if dataline contanins huge amount of lines.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;is there any way to do so or not?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 20:36:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328862#M73484</guid>
      <dc:creator>Garik</dc:creator>
      <dc:date>2017-01-31T20:36:23Z</dc:date>
    </item>
    <item>
      <title>Re: input methods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328864#M73486</link>
      <description>&lt;P&gt;Here's one approach.&amp;nbsp; You may benefit by adding LENGTH statements for GG and HH:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;data input_method;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;infile datalines truncover;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;input GG_list &amp;amp; $60. / HH_list &amp;amp; $60.;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;do _n_=1 by 1 until (GG=' ' and HH=' ');&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;GG = scan(GG_LIST, _n_);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;HH = scan(HH_LIST, _n_);&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if GG &amp;gt; ' ' or HH &amp;gt; ' ' then output;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;end;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;keep gg hh;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;datalines;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;G A R I K&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;H A K O B Y A N&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 20:44:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328864#M73486</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-01-31T20:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: input methods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328865#M73487</link>
      <description>&lt;P&gt;Looks like a simple transpose problem. Not sure where you came up the name for columns in the resulting output. &amp;nbsp;This will just name them row1, row2, etc .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data raw ;
  length row col 8 value $20 ;
  infile cards col=cc length=len truncover ;
  row+1;
  do col=1 by 1 until ( cc &amp;gt; len) ;
    input value @ ;
    output;
  end;
cards;
G A R I K
H A K O B Y A N
Another set of values
;

proc sort data=raw;
  by col row ;
run;

proc transpose data=raw prefix=row out=want(drop=_name_);
  by col ;
  id row ;
  var value ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Jan 2017 20:45:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328865#M73487</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-01-31T20:45:28Z</dc:date>
    </item>
    <item>
      <title>Re: input methods</title>
      <link>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328866#M73488</link>
      <description>&lt;P&gt;This will do what you are requesting but is not going to be easily extended to a generic use. The 14 would have to be replaced by the length of the longest line and the better be a space between each character. If the spaces came from a double-byte character set then maybe you wouldn't need the "by 2" bit depending on your current session encoding.&lt;/P&gt;
&lt;PRE&gt;data input_method;
   infile datalines n=2 truncover;
   do i=1 to 14 by 2;
      input #1 @i GG $  #2 @i  HH $ @@ ;
      output;
   end;
   drop i;
input;
datalines;
G A R I K      
H A K O B Y A N
;
run;
&lt;/PRE&gt;
&lt;P&gt;If you have an actual application for this then you might look at reading the entire line(s) into variables and parsing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Jan 2017 20:48:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/input-methods/m-p/328866#M73488</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-01-31T20:48:12Z</dc:date>
    </item>
  </channel>
</rss>

