<?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: one var out of synch in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/one-var-out-of-synch/m-p/63953#M13879</link>
    <description>Look at using a DATA step and SET parameter options to process your file backwards.&lt;BR /&gt;
&lt;BR /&gt;
Or, another option, take special variable _N_ and assign it to a variable of your own, then use that to re-sort the file.  Then you can use the LAG function to transfer SAS variable values to an adjacent observation. When complete, then re-sort your file back into original sequence.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Fri, 13 Aug 2010 23:40:10 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2010-08-13T23:40:10Z</dc:date>
    <item>
      <title>one var out of synch</title>
      <link>https://communities.sas.com/t5/SAS-Programming/one-var-out-of-synch/m-p/63952#M13878</link>
      <description>I have the table below being generated and I'm looking to exchange the null in var1 for obs 1 to 1.  Basically I need to move the data for var1 up one observation and then drop obs 4.&lt;BR /&gt;
&lt;BR /&gt;
any ideas on the simplest way to complete this task?&lt;BR /&gt;
&lt;BR /&gt;
obs  var1     var2 var3&lt;BR /&gt;
1      null    22   33&lt;BR /&gt;
2      1       22   33 &lt;BR /&gt;
3      2       22   33&lt;BR /&gt;
4      3        0     0&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: veblen&lt;BR /&gt;
&lt;BR /&gt;
Message was edited by: veblen

Message was edited by: veblen</description>
      <pubDate>Fri, 13 Aug 2010 21:58:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/one-var-out-of-synch/m-p/63952#M13878</guid>
      <dc:creator>veblen</dc:creator>
      <dc:date>2010-08-13T21:58:19Z</dc:date>
    </item>
    <item>
      <title>Re: one var out of synch</title>
      <link>https://communities.sas.com/t5/SAS-Programming/one-var-out-of-synch/m-p/63953#M13879</link>
      <description>Look at using a DATA step and SET parameter options to process your file backwards.&lt;BR /&gt;
&lt;BR /&gt;
Or, another option, take special variable _N_ and assign it to a variable of your own, then use that to re-sort the file.  Then you can use the LAG function to transfer SAS variable values to an adjacent observation. When complete, then re-sort your file back into original sequence.&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Fri, 13 Aug 2010 23:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/one-var-out-of-synch/m-p/63953#M13879</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2010-08-13T23:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: one var out of synch</title>
      <link>https://communities.sas.com/t5/SAS-Programming/one-var-out-of-synch/m-p/63954#M13880</link>
      <description>Thanks Scott!!!&lt;BR /&gt;
&lt;BR /&gt;
I appreciate the Friday response.&lt;BR /&gt;
&lt;BR /&gt;
I think I will look at the second approach.  I neglected to show the before and after in my initial post.  Plus I used the same values for vars 2 and 3 but they are different. &lt;BR /&gt;
 &lt;BR /&gt;
table A&lt;BR /&gt;
obs var1 var2 var3&lt;BR /&gt;
1 null 22 33&lt;BR /&gt;
2 1 23 34&lt;BR /&gt;
3 2 24 35&lt;BR /&gt;
4 3 0 0&lt;BR /&gt;
&lt;BR /&gt;
table B&lt;BR /&gt;
obs var1 var2 var3&lt;BR /&gt;
1 1 22 33&lt;BR /&gt;
2 2 23 34&lt;BR /&gt;
3 3 24 35&lt;BR /&gt;
4 x 0 0</description>
      <pubDate>Fri, 13 Aug 2010 23:49:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/one-var-out-of-synch/m-p/63954#M13880</guid>
      <dc:creator>veblen</dc:creator>
      <dc:date>2010-08-13T23:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: one var out of synch</title>
      <link>https://communities.sas.com/t5/SAS-Programming/one-var-out-of-synch/m-p/63955#M13881</link>
      <description>Veblen,&lt;BR /&gt;
&lt;BR /&gt;
Even less work, take a look at the notion of look ahead look back as described at:&lt;BR /&gt;
&lt;A href="http://www.sascommunity.org/wiki/Look-Ahead_and_Look-Back" target="_blank"&gt;http://www.sascommunity.org/wiki/Look-Ahead_and_Look-Back&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
Of course, given your current need, you only have to use the look ahead portion and, for the last record, either delete it or set the value to missing.&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Art</description>
      <pubDate>Sat, 14 Aug 2010 22:05:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/one-var-out-of-synch/m-p/63955#M13881</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2010-08-14T22:05:42Z</dc:date>
    </item>
  </channel>
</rss>

