<?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 get the value of a particular row of a variable ? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-value-of-a-particular-row-of-a-variable/m-p/653890#M196411</link>
    <description>&lt;P&gt;For the value of K in the preceding observation, use the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0l66p5oqex1f2n1quuopdvtcjqb.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;LAG()&lt;/A&gt; function; for the value in the following observation, use a &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Look-Ahead-and-Look-Back/ta-p/475772" target="_blank" rel="noopener"&gt;look-ahead&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Sat, 06 Jun 2020 12:24:46 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-06-06T12:24:46Z</dc:date>
    <item>
      <title>How to get the value of a particular row of a variable ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-value-of-a-particular-row-of-a-variable/m-p/653886#M196407</link>
      <description>If I have a column named “K” with 25 rows .&lt;BR /&gt;How can I add a new column DK[i]=K[i+1]+k[i-1] to the table?(when 2&amp;lt;i &amp;lt;25.)&lt;BR /&gt;I have no idea how to get the value of a particular row of a column.&lt;BR /&gt;&lt;BR /&gt;Please give me some help</description>
      <pubDate>Sat, 06 Jun 2020 11:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-value-of-a-particular-row-of-a-variable/m-p/653886#M196407</guid>
      <dc:creator>Siennayun</dc:creator>
      <dc:date>2020-06-06T11:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the value of a particular row of a variable ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-value-of-a-particular-row-of-a-variable/m-p/653887#M196408</link>
      <description>&lt;P&gt;It usually helps to indicate some data and what you expect the output for that given data to be.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Does your data set have 25 observations or are you asking to only process some observations out of a larger set?&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 11:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-value-of-a-particular-row-of-a-variable/m-p/653887#M196408</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-06-06T11:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the value of a particular row of a variable ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-value-of-a-particular-row-of-a-variable/m-p/653890#M196411</link>
      <description>&lt;P&gt;For the value of K in the preceding observation, use the &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=lefunctionsref&amp;amp;docsetTarget=n0l66p5oqex1f2n1quuopdvtcjqb.htm&amp;amp;locale=en" target="_blank" rel="noopener"&gt;LAG()&lt;/A&gt; function; for the value in the following observation, use a &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Look-Ahead-and-Look-Back/ta-p/475772" target="_blank" rel="noopener"&gt;look-ahead&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 12:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-value-of-a-particular-row-of-a-variable/m-p/653890#M196411</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-06T12:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the value of a particular row of a variable ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-value-of-a-particular-row-of-a-variable/m-p/653924#M196429</link>
      <description>&lt;P&gt;Below one way to go.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have; 
  do k=1 to 25;
    output;
  end;
  stop;
run;

data want(drop=_k);
  merge have have(firstobs=2 keep=k rename=(k=_k));
  dk1=lag(k)+_k;
  dk2=sum(lag(k),_k);
run;

proc print data=want;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1591473526097.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/40603iB550A0A4111834C6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1591473526097.png" alt="Patrick_0-1591473526097.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 06 Jun 2020 19:58:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-value-of-a-particular-row-of-a-variable/m-p/653924#M196429</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2020-06-06T19:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the value of a particular row of a variable ?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-value-of-a-particular-row-of-a-variable/m-p/653970#M196444</link>
      <description>Thank you so much for your help.&lt;BR /&gt;I’ve figured it out.&lt;BR /&gt;</description>
      <pubDate>Sat, 06 Jun 2020 23:54:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-value-of-a-particular-row-of-a-variable/m-p/653970#M196444</guid>
      <dc:creator>Siennayun</dc:creator>
      <dc:date>2020-06-06T23:54:33Z</dc:date>
    </item>
  </channel>
</rss>

