<?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 Calculate the difference in the same variable considering the order of other variables in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-difference-in-the-same-variable-considering-the/m-p/862473#M38104</link>
    <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="S_Mario_1-1678112933606.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/81106iC889BB46666A6130/image-size/medium?v=v2&amp;amp;px=400" role="button" title="S_Mario_1-1678112933606.png" alt="S_Mario_1-1678112933606.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is a piece of my output.&lt;/P&gt;&lt;P&gt;what I want to get is the difference between the value of "Diff" when "Flag" =1 and the value of "Diff" when "Flag" =0 for each "Date"&amp;nbsp;as happens on line 4 where 57(flag=1) - 7 (flag=0) = 50 on 01/02/2020.&lt;BR /&gt;&lt;BR /&gt;The result of diff_flag comes from the following data step:&lt;/P&gt;&lt;PRE&gt;data want;
set have;
by date;
diff_flag = dif(Diff);
run;&lt;/PRE&gt;&lt;P&gt;Thanks in advance for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 06 Mar 2023 14:36:41 GMT</pubDate>
    <dc:creator>S_Mario</dc:creator>
    <dc:date>2023-03-06T14:36:41Z</dc:date>
    <item>
      <title>Calculate the difference in the same variable considering the order of other variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-difference-in-the-same-variable-considering-the/m-p/862473#M38104</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="S_Mario_1-1678112933606.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/81106iC889BB46666A6130/image-size/medium?v=v2&amp;amp;px=400" role="button" title="S_Mario_1-1678112933606.png" alt="S_Mario_1-1678112933606.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;this is a piece of my output.&lt;/P&gt;&lt;P&gt;what I want to get is the difference between the value of "Diff" when "Flag" =1 and the value of "Diff" when "Flag" =0 for each "Date"&amp;nbsp;as happens on line 4 where 57(flag=1) - 7 (flag=0) = 50 on 01/02/2020.&lt;BR /&gt;&lt;BR /&gt;The result of diff_flag comes from the following data step:&lt;/P&gt;&lt;PRE&gt;data want;
set have;
by date;
diff_flag = dif(Diff);
run;&lt;/PRE&gt;&lt;P&gt;Thanks in advance for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 14:36:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-the-difference-in-the-same-variable-considering-the/m-p/862473#M38104</guid>
      <dc:creator>S_Mario</dc:creator>
      <dc:date>2023-03-06T14:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the difference in the same variable considering the order of other variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-difference-in-the-same-variable-considering-the/m-p/862562#M38116</link>
      <description>&lt;P&gt;Please post your data as text, not as an image. To work with it, we'd have to type it out or convert it to text which is an extra step in trying to help you.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Preferably a data step, but text at minimum.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you only want the results when flag=1? If so, delete the results on 0.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise, please clarify your expected output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set have;
by date;
diff_flag = dif(Diff);

if flag_servisizio=0 then call missing(diff_flag);

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2023 19:46:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-the-difference-in-the-same-variable-considering-the/m-p/862562#M38116</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-03-06T19:46:05Z</dc:date>
    </item>
    <item>
      <title>Re: Calculate the difference in the same variable considering the order of other variables</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Calculate-the-difference-in-the-same-variable-considering-the/m-p/862664#M38119</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;sorry for how I put the problem, I'll take it into account for next time.</description>
      <pubDate>Tue, 07 Mar 2023 14:19:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Calculate-the-difference-in-the-same-variable-considering-the/m-p/862664#M38119</guid>
      <dc:creator>S_Mario</dc:creator>
      <dc:date>2023-03-07T14:19:58Z</dc:date>
    </item>
  </channel>
</rss>

