<?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: BEST WAY TO LEAD A VARIABLE in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/BEST-WAY-TO-LEAD-A-VARIABLE/m-p/546990#M8312</link>
    <description>Awesome! Worked fine!</description>
    <pubDate>Thu, 28 Mar 2019 18:25:47 GMT</pubDate>
    <dc:creator>d6k5d3</dc:creator>
    <dc:date>2019-03-28T18:25:47Z</dc:date>
    <item>
      <title>BEST WAY TO LEAD A VARIABLE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/BEST-WAY-TO-LEAD-A-VARIABLE/m-p/546756#M8265</link>
      <description>&lt;P&gt;For a dataset like the following one:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
input interval zzz;
cards;
99 .345
100 -.398
101 .546
102 .968
103 -.012
104 .489
105 .005;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;how can I create 1 lead in variable zzz? I have found people recommending about PROC EXPAND, but I could not work that out. Would you please help?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 23:03:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/BEST-WAY-TO-LEAD-A-VARIABLE/m-p/546756#M8265</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2019-03-27T23:03:02Z</dc:date>
    </item>
    <item>
      <title>Re: BEST WAY TO LEAD A VARIABLE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/BEST-WAY-TO-LEAD-A-VARIABLE/m-p/546760#M8266</link>
      <description>&lt;P&gt;So what should the results look like?&amp;nbsp; Does the final observation get deleted?&lt;/P&gt;</description>
      <pubDate>Wed, 27 Mar 2019 23:47:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/BEST-WAY-TO-LEAD-A-VARIABLE/m-p/546760#M8266</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2019-03-27T23:47:27Z</dc:date>
    </item>
    <item>
      <title>Re: BEST WAY TO LEAD A VARIABLE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/BEST-WAY-TO-LEAD-A-VARIABLE/m-p/546763#M8267</link>
      <description>&lt;P&gt;Not sure if there is a BEST way. Here is an easy way.&amp;nbsp; I assume you meant to include that last line of data in your example?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data example;
input interval zzz;
cards;
99 .345
100 -.398
101 .546
102 .968
103 -.012
104 .489
105 .005
;

data want ;
  set example;
  set example(firstobs=2 keep=zzz rename=(zzz=zzz_lead1)) example(obs=1 drop=_all_);
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;                              zzz_
Obs    interval      zzz      lead1

 1         99       0.345    -0.398
 2        100      -0.398     0.546
 3        101       0.546     0.968
 4        102       0.968    -0.012
 5        103      -0.012     0.489
 6        104       0.489     0.005
 7        105       0.005      .
&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Mar 2019 01:13:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/BEST-WAY-TO-LEAD-A-VARIABLE/m-p/546763#M8267</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-03-28T01:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: BEST WAY TO LEAD A VARIABLE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/BEST-WAY-TO-LEAD-A-VARIABLE/m-p/546770#M8273</link>
      <description>&lt;P&gt;People recommending &lt;STRONG&gt;proc expand&lt;/STRONG&gt; were right, as long as you have SAS/ETS licenced&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc expand data=example out=want;
id interval;
convert zzz=zzz_lead / transformout=(lead 1);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Mar 2019 02:28:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/BEST-WAY-TO-LEAD-A-VARIABLE/m-p/546770#M8273</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-03-28T02:28:30Z</dc:date>
    </item>
    <item>
      <title>Re: BEST WAY TO LEAD A VARIABLE</title>
      <link>https://communities.sas.com/t5/New-SAS-User/BEST-WAY-TO-LEAD-A-VARIABLE/m-p/546990#M8312</link>
      <description>Awesome! Worked fine!</description>
      <pubDate>Thu, 28 Mar 2019 18:25:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/BEST-WAY-TO-LEAD-A-VARIABLE/m-p/546990#M8312</guid>
      <dc:creator>d6k5d3</dc:creator>
      <dc:date>2019-03-28T18:25:47Z</dc:date>
    </item>
  </channel>
</rss>

