<?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: different method in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/different-method/m-p/533896#M73851</link>
    <description>&lt;P&gt;Using one variable instead of multiple lag() calls renders the same result:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
set sashelp.class;
s1 = lag(age);
s2 = 1/lag(age);
s3 = weight/lag(age);
run;

data test2;
set sashelp.class;
agelag = lag(age);
s1 = agelag;
s2 = 1/agelag;
s3 = weight/agelag;
drop agelag;
run;

proc compare
  base=test1 
  compare=test2
  criterion=0.00001
  method=RELATIVE
  out=comp(label="Compare Data for TEST1 and TEST2")
  outstats=stat(label="Compare Data Summary Statistics for TEST1 and TEST2")
  outnoequal
  maxprint=50
;
var Name Sex Age Height Weight s1 s2 s3;
with Name Sex Age Height Weight s1 s2 s3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Dataset comp will be empty, meaning both datasets are identical.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Feb 2019 12:45:24 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2019-02-08T12:45:24Z</dc:date>
    <item>
      <title>different method</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/different-method/m-p/533879#M73850</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;/P&gt;&lt;P&gt;i need to make sure about kind of code whether it is correct or not&lt;/P&gt;&lt;P&gt;first i usually use creating a variable (var_lag) to calculate the delta of that var for instance total assets( TA_lag) or inventory&amp;nbsp;&lt;/P&gt;&lt;P&gt;then i used the statement as follows&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data real_em;
 set erm_var;
 CFLO_real= (CSFO/TA_lag);
TA1=(1/TA_lag);
S1= (sales/TA_lag);
S2= (delta_sales/TA_lag);
S3= (delta_sales_lag/TA_lag);
S4= (sales_lag/TA_lag);
PRODa= (PROD/TA_lag);
EXPENa= (EXPEN/TA_lag);
run; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;then i tried to change my way by using this statement directly without creating var_lag&lt;/P&gt;&lt;P&gt;as follows&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; data attempt; set erm_var;
 cshflo=csfo/lag(Total_assets);
 TA1=(1/lag(Total_assets));
S1= (sales/lag(Total_assets));
S2= (delta_sales/lag(Total_assets));
S3= (delta_sales_lag/lag(Total_assets));
S4= (sales_lag/lag(Total_assets));
PRODa= (PROD/lag(Total_assets));
EXPENa= (EXPEN/lag(Total_assets));
 run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;of course by first way there were a lot of missing value while in the second way less than, so please which way is correct&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 10:33:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/different-method/m-p/533879#M73850</guid>
      <dc:creator>Radwan</dc:creator>
      <dc:date>2019-02-08T10:33:32Z</dc:date>
    </item>
    <item>
      <title>Re: different method</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/different-method/m-p/533896#M73851</link>
      <description>&lt;P&gt;Using one variable instead of multiple lag() calls renders the same result:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
set sashelp.class;
s1 = lag(age);
s2 = 1/lag(age);
s3 = weight/lag(age);
run;

data test2;
set sashelp.class;
agelag = lag(age);
s1 = agelag;
s2 = 1/agelag;
s3 = weight/agelag;
drop agelag;
run;

proc compare
  base=test1 
  compare=test2
  criterion=0.00001
  method=RELATIVE
  out=comp(label="Compare Data for TEST1 and TEST2")
  outstats=stat(label="Compare Data Summary Statistics for TEST1 and TEST2")
  outnoequal
  maxprint=50
;
var Name Sex Age Height Weight s1 s2 s3;
with Name Sex Age Height Weight s1 s2 s3;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Dataset comp will be empty, meaning both datasets are identical.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 12:45:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/different-method/m-p/533896#M73851</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-02-08T12:45:24Z</dc:date>
    </item>
  </channel>
</rss>

