<?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: reading data in data lines in the reverse order in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445816#M111775</link>
    <description>Thank you</description>
    <pubDate>Thu, 15 Mar 2018 13:03:58 GMT</pubDate>
    <dc:creator>rk7</dc:creator>
    <dc:date>2018-03-15T13:03:58Z</dc:date>
    <item>
      <title>reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445708#M111727</link>
      <description>&lt;P&gt;can we read data in datalines starting from the end&amp;nbsp;&lt;/P&gt;&lt;P&gt;* Using appropriate input option and create a SAS data set named 'COLLEGE' using the data below&lt;/P&gt;&lt;P&gt;* Variables: name, title, tenure, number&lt;BR /&gt;&lt;BR /&gt;* Data:&lt;BR /&gt;12345676890123456789012345678890&lt;BR /&gt;Stevenson Ph.D. Y 2&lt;BR /&gt;Smith Ph.D. N 3&lt;BR /&gt;Goldstein M.D. Y 1&lt;BR /&gt;George Stevenson Ph.D. Y 2&lt;BR /&gt;Fred Smith Ph.D. N 3&lt;BR /&gt;Alissa Goldstein M.D. Y 1&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 03:03:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445708#M111727</guid>
      <dc:creator>rk7</dc:creator>
      <dc:date>2018-03-15T03:03:09Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445711#M111729</link>
      <description>&lt;P&gt;Why would you want to do that? Is this a study question? I can't see any benefit in even attempting this.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 03:18:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445711#M111729</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-15T03:18:09Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445712#M111730</link>
      <description>&lt;P&gt;the actual data with spaces&lt;/P&gt;&lt;P&gt;Stevenson Ph.D.&amp;nbsp; Y 2&lt;BR /&gt;Smith Ph.D.&amp;nbsp; &amp;nbsp;N&amp;nbsp; &amp;nbsp; 3&lt;BR /&gt;Goldstein&amp;nbsp; &amp;nbsp;M.D.&amp;nbsp; &amp;nbsp;Y&amp;nbsp; 1&lt;BR /&gt;George Stevenson&amp;nbsp; &amp;nbsp;Ph.D. Y 2&lt;BR /&gt;Fred Smith&amp;nbsp; &amp;nbsp;Ph.D.&amp;nbsp; &amp;nbsp; N&amp;nbsp; &amp;nbsp; 3&lt;BR /&gt;Alissa Goldstein&amp;nbsp; M.D.&amp;nbsp; Y&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which makes it tough to read the data&amp;nbsp;&lt;/P&gt;&lt;P&gt;we need to use the data with moddifiers and other input options&lt;/P&gt;&lt;P&gt;so i was trying to read the data based on the number . so, i was asking if we could read the data in reverse order&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 03:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445712#M111730</guid>
      <dc:creator>rk7</dc:creator>
      <dc:date>2018-03-15T03:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445717#M111732</link>
      <description>&lt;P&gt;Each non-standard case requires code that can extract what you want/need. e.g., in this case you could use something like:&lt;/P&gt;
&lt;PRE&gt;data have (drop=_:);
  input @;
  length name $25;
  length answer $1;
  CALL SCAN(_infile_, -2, _position, _length);
  name=substr(_infile_,1,_position-2);
  answer=substr(_infile_,_position,_length);
  type=input(substr(_infile_,_position+_length),8.);
  cards;
Stevenson Ph.D.  Y 2
Smith Ph.D.   N    3
Goldstein   M.D.   Y  1
George Stevenson   Ph.D. Y 2
Fred Smith   Ph.D.    N    3
Alissa Goldstein  M.D.  Y  1
;

&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 03:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445717#M111732</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-03-15T03:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445718#M111733</link>
      <description>&lt;P&gt;Regular expressions are a very flexible tool to read in almost anything&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines truncover;
length name $40 title $12 tenure $1 number 8;
if not prxId then 
    prxId + prxParse("/(.+?)\s+(\S+)\s+([YN])\s+(\d+)/i");
input line $100.;
if prxmatch(prxId, line) then do;
    name = prxPosn(prxId,1,line);
    title = prxPosn(prxId,2,line);
    tenure = prxPosn(prxId,3,line);
    number = input(prxPosn(prxId,4,line), ?? best.);
end;
drop prxid line;
datalines;
Stevenson Ph.D. Y 2
Smith Ph.D. N 3
Goldstein M.D. Y 1
George Stevenson Ph.D. Y 2
Fred Smith Ph.D. N 3
Alissa Goldstein M.D. Y 1
;

proc print; run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;                Obs    name                title    tenure    number

                 1     Stevenson           Ph.D.      Y          2
                 2     Smith               Ph.D.      N          3
                 3     Goldstein           M.D.       Y          1
                 4     George Stevenson    Ph.D.      Y          2
                 5     Fred Smith          Ph.D.      N          3
                 6     Alissa Goldstein    M.D.       Y          1
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 03:08:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445718#M111733</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-16T03:08:28Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445723#M111736</link>
      <description>In the output the name includes the title and can you pls include the the reference for this concept&lt;BR /&gt;</description>
      <pubDate>Thu, 15 Mar 2018 04:40:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445723#M111736</guid>
      <dc:creator>rk7</dc:creator>
      <dc:date>2018-03-15T04:40:50Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445724#M111737</link>
      <description>In the output the name includes the title and can you pls include the the reference for this concept</description>
      <pubDate>Thu, 15 Mar 2018 04:40:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445724#M111737</guid>
      <dc:creator>rk7</dc:creator>
      <dc:date>2018-03-15T04:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445728#M111739</link>
      <description>&lt;P&gt;Simpler then...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile datalines truncover;
length name $64 tenure $1 number 8;
if not prxId then 
    prxId + prxParse("/(.+?)\s+([YN])\s+(\d+)/i");
input line $100.;
if prxmatch(prxId, line) then do;
    name = prxPosn(prxId,1,line);
    tenure = prxPosn(prxId,2,line);
    number = input(prxPosn(prxId,3,line), ?? best.);
end;
drop prxid line;
datalines;
Stevenson Ph.D. Y 2
Smith Ph.D. N 3
Goldstein M.D. Y 1
George Stevenson Ph.D. Y 2
Fred Smith Ph.D. N 3
Alissa Goldstein M.D. Y 1
;

proc print; run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;                 Obs    name                      tenure    number

                  1     Stevenson Ph.D.             Y          2
                  2     Smith Ph.D.                 N          3
                  3     Goldstein M.D.              Y          1
                  4     George Stevenson Ph.D.      Y          2
                  5     Fred Smith Ph.D.            N          3
                  6     Alissa Goldstein M.D.       Y          1
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 03:11:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445728#M111739</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-16T03:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445743#M111743</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173586"&gt;@rk7&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;And just for fun here an approach which uses your initial &lt;EM&gt;reverse&lt;/EM&gt; idea&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover dlm=' ';
  input @;
  _infile_=reverse(strip(_infile_));
  input number:best32. tenure:$1. title:$10. name $80.;
  title=reverse(strip(title));
  name=reverse(strip(name));
  datalines;
Stevenson Ph.D. Y 2
Smith Ph.D. N 3
Goldstein M.D. Y 1
George Stevenson Ph.D. Y 2
Fred Smith Ph.D. N 3
Alissa Goldstein M.D. Y 1
;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Mar 2018 06:48:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445743#M111743</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-03-15T06:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445809#M111770</link>
      <description>&lt;P&gt;The reference for all data step programming is:&amp;nbsp;&lt;A href="http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=pgmmvaov&amp;amp;docsetTarget=pgmsasov.htm&amp;amp;locale=en" target="_blank"&gt;http://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.3&amp;amp;docsetId=pgmmvaov&amp;amp;docsetTarget=pgmsasov.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is, learn how the data step works and all of the functions that are available to you. The same documentation applies to all of the solutions that have been proposed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 12:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445809#M111770</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-03-15T12:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445810#M111771</link>
      <description>I mean the name should n't include title</description>
      <pubDate>Thu, 15 Mar 2018 12:52:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445810#M111771</guid>
      <dc:creator>rk7</dc:creator>
      <dc:date>2018-03-15T12:52:22Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445816#M111775</link>
      <description>Thank you</description>
      <pubDate>Thu, 15 Mar 2018 13:03:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445816#M111775</guid>
      <dc:creator>rk7</dc:creator>
      <dc:date>2018-03-15T13:03:58Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445864#M111806</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173586"&gt;@rk7&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;can we read data in datalines starting from the end&amp;nbsp;&lt;/P&gt;
&lt;P&gt;* Using appropriate input option and create a SAS data set named 'COLLEGE' using the data below&lt;/P&gt;
&lt;P&gt;* Variables: name, title, tenure, number&lt;BR /&gt;&lt;BR /&gt;* Data:&lt;BR /&gt;12345676890123456789012345678890&lt;BR /&gt;Stevenson Ph.D. Y 2&lt;BR /&gt;Smith Ph.D. N 3&lt;BR /&gt;Goldstein M.D. Y 1&lt;BR /&gt;George Stevenson Ph.D. Y 2&lt;BR /&gt;Fred Smith Ph.D. N 3&lt;BR /&gt;Alissa Goldstein M.D. Y 1&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Please explain the role of&lt;/P&gt;
&lt;P&gt;12345676890123456789012345678890&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it is not actually part of your data do not include it as part of your example.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Mar 2018 15:12:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/445864#M111806</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-03-15T15:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/446037#M111848</link>
      <description>the numbers i have used is to find/determine the position of the data.&lt;BR /&gt;like , starting point and length of the variable.&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Mar 2018 01:49:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/446037#M111848</guid>
      <dc:creator>rk7</dc:creator>
      <dc:date>2018-03-16T01:49:37Z</dc:date>
    </item>
    <item>
      <title>Re: reading data in data lines in the reverse order</title>
      <link>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/446056#M111855</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/173586"&gt;@rk7&lt;/a&gt;, I edited my posts to show the results.&lt;/P&gt;</description>
      <pubDate>Fri, 16 Mar 2018 03:10:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/reading-data-in-data-lines-in-the-reverse-order/m-p/446056#M111855</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2018-03-16T03:10:04Z</dc:date>
    </item>
  </channel>
</rss>

