<?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: Retain Last obs to new variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Retain-Last-obs-to-new-variable/m-p/57899#M16151</link>
    <description>Hello R_Win;&lt;BR /&gt;
&lt;BR /&gt;
This is a solution:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data l;&lt;BR /&gt;
input id;&lt;BR /&gt;
cards;&lt;BR /&gt;
45&lt;BR /&gt;
63&lt;BR /&gt;
1023&lt;BR /&gt;
run;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  set l end=l;&lt;BR /&gt;
  if l then call symputx ('id',id);&lt;BR /&gt;
run;&lt;BR /&gt;
data r;&lt;BR /&gt;
  set l;&lt;BR /&gt;
  new_id=&amp;amp;id;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
    <pubDate>Wed, 27 Apr 2011 13:59:18 GMT</pubDate>
    <dc:creator>SPR</dc:creator>
    <dc:date>2011-04-27T13:59:18Z</dc:date>
    <item>
      <title>Retain Last obs to new variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-Last-obs-to-new-variable/m-p/57898#M16150</link>
      <description>data l;&lt;BR /&gt;
input id;&lt;BR /&gt;
cards;&lt;BR /&gt;
45&lt;BR /&gt;
63&lt;BR /&gt;
1023&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
Now i want to retain the last obs to new variable;&lt;BR /&gt;
&lt;BR /&gt;
output:&lt;BR /&gt;
id      new_id&lt;BR /&gt;
45      1023&lt;BR /&gt;
63       1023&lt;BR /&gt;
1023   1023&lt;BR /&gt;
Here 1023 is the last obs it shold move to new variable new_id</description>
      <pubDate>Wed, 27 Apr 2011 13:41:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-Last-obs-to-new-variable/m-p/57898#M16150</guid>
      <dc:creator>R_Win</dc:creator>
      <dc:date>2011-04-27T13:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Retain Last obs to new variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-Last-obs-to-new-variable/m-p/57899#M16151</link>
      <description>Hello R_Win;&lt;BR /&gt;
&lt;BR /&gt;
This is a solution:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data l;&lt;BR /&gt;
input id;&lt;BR /&gt;
cards;&lt;BR /&gt;
45&lt;BR /&gt;
63&lt;BR /&gt;
1023&lt;BR /&gt;
run;&lt;BR /&gt;
data _null_;&lt;BR /&gt;
  set l end=l;&lt;BR /&gt;
  if l then call symputx ('id',id);&lt;BR /&gt;
run;&lt;BR /&gt;
data r;&lt;BR /&gt;
  set l;&lt;BR /&gt;
  new_id=&amp;amp;id;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Wed, 27 Apr 2011 13:59:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-Last-obs-to-new-variable/m-p/57899#M16151</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2011-04-27T13:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Retain Last obs to new variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-Last-obs-to-new-variable/m-p/57900#M16152</link>
      <description>just for clarification....&lt;BR /&gt;
&lt;BR /&gt;
set l end=l;  &lt;BR /&gt;
&lt;BR /&gt;
That's the letter L...not the number 1.  Sometimes confusing in certain fonts.</description>
      <pubDate>Wed, 27 Apr 2011 14:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-Last-obs-to-new-variable/m-p/57900#M16152</guid>
      <dc:creator>DBailey</dc:creator>
      <dc:date>2011-04-27T14:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Retain Last obs to new variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Retain-Last-obs-to-new-variable/m-p/57901#M16153</link>
      <description>[pre]&lt;BR /&gt;
data l;&lt;BR /&gt;
input id;&lt;BR /&gt;
cards;&lt;BR /&gt;
45&lt;BR /&gt;
63&lt;BR /&gt;
1023&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
 set l nobs=nobs;&lt;BR /&gt;
 if _n_ eq 1 then set l(rename=(id=new_id)) point=nobs;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Thu, 28 Apr 2011 01:32:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Retain-Last-obs-to-new-variable/m-p/57901#M16153</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-04-28T01:32:13Z</dc:date>
    </item>
  </channel>
</rss>

