<?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: Calculation of values that rely on a date variable in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Calculation-of-values-that-rely-on-a-date-variable/m-p/637312#M19077</link>
    <description>&lt;P&gt;Yes that is correct. This is an example of the output.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Subject Type      Date           Procedure    Measurement     Output
500   Initial    15 AUG 2017     Invasive        20            20/20
500   Initial    15 AUG 2017     Surface         35            35/35
500   Followup   15 AUG 2018     Invasive        54            54/20
428   Followup    15 AUG 2018    Outer           29            29/10
765   Seventh     3 AUG 2018     Other           13            13/19
500   Followup    3 JUL 2018     surface         98            98/35
428   Initial     3 JUL 2017     Outer           10            10/10
765   Initial     20 JUL 2019    Other           19            19/19
610   Third       20 AUG 2019    Invasive        66            66/17
610   Initial     17 Mar 2018    Invasive        17            17/17&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 Apr 2020 17:42:23 GMT</pubDate>
    <dc:creator>AshJuri</dc:creator>
    <dc:date>2020-04-03T17:42:23Z</dc:date>
    <item>
      <title>Calculation of values that rely on a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Calculation-of-values-that-rely-on-a-date-variable/m-p/637309#M19075</link>
      <description>&lt;P&gt;Hi, I am trying to calculate t&lt;SPAN&gt;he value of the last&amp;nbsp;measurement&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;taken (according to the date column) divided by the&amp;nbsp;lowest&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;value recorded (according to the measurement column)&amp;nbsp;&amp;nbsp;if two values in the “SUBJECT” column match and two values in the “PROCEDURE” column match. The the calculation would be produced in a new column. I am having trouble with this and I would appreciate a solution to this matter.&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="language-sas"&gt;&lt;CODE&gt;data Have;
	input Subject Type :$12. Date &amp;amp;:anydtdte. Procedure :$12. Measurement;
	format date yymmdd10.;
	datalines;

500   Initial    15 AUG 2017      Invasive    20 
500   Initial    15 AUG 2017     Surface      35 
500   Followup   15 AUG 2018     Invasive     54 
428   Followup    15 AUG 2018      Outer      29 
765   Seventh     3 AUG 2018      Other       13 
500   Followup    3 JUL 2018      Surface     98 
428   Initial     3 JUL 2017     Outer        10 
765   Initial     20 JUL 2019     Other       19 
610   Third       20 AUG 2019     Invasive    66 
610   Initial     17 Mar 2018     Invasive    17 
;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 17:12:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Calculation-of-values-that-rely-on-a-date-variable/m-p/637309#M19075</guid>
      <dc:creator>AshJuri</dc:creator>
      <dc:date>2020-04-03T17:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of values that rely on a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Calculation-of-values-that-rely-on-a-date-variable/m-p/637310#M19076</link>
      <description>&lt;P&gt;I assume you mean&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;last&amp;nbsp;measurement&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;taken (according to the date column) &lt;FONT color="#FF0000"&gt;for each subject&lt;/FONT&gt;"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;"the&amp;nbsp;lowest&amp;nbsp;value recorded (according to the measurement column) &lt;FONT color="#FF0000"&gt;for each subject&lt;/FONT&gt;"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Is that correct?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;if two values in the “SUBJECT” column match and two values in the “PROCEDURE” column match&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;what happens for rows where there are not two values of SUBJECT that match? such as row 5?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Can you show us the desired output table, please?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 17:30:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Calculation-of-values-that-rely-on-a-date-variable/m-p/637310#M19076</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-03T17:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of values that rely on a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Calculation-of-values-that-rely-on-a-date-variable/m-p/637312#M19077</link>
      <description>&lt;P&gt;Yes that is correct. This is an example of the output.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Subject Type      Date           Procedure    Measurement     Output
500   Initial    15 AUG 2017     Invasive        20            20/20
500   Initial    15 AUG 2017     Surface         35            35/35
500   Followup   15 AUG 2018     Invasive        54            54/20
428   Followup    15 AUG 2018    Outer           29            29/10
765   Seventh     3 AUG 2018     Other           13            13/19
500   Followup    3 JUL 2018     surface         98            98/35
428   Initial     3 JUL 2017     Outer           10            10/10
765   Initial     20 JUL 2019    Other           19            19/19
610   Third       20 AUG 2019    Invasive        66            66/17
610   Initial     17 Mar 2018    Invasive        17            17/17&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Apr 2020 17:42:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Calculation-of-values-that-rely-on-a-date-variable/m-p/637312#M19077</guid>
      <dc:creator>AshJuri</dc:creator>
      <dc:date>2020-04-03T17:42:23Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of values that rely on a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Calculation-of-values-that-rely-on-a-date-variable/m-p/637316#M19078</link>
      <description>&lt;P&gt;Yes, that is correct. This is an example of the intended output table that I hopes clarifies.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;*Intended output table
Subject Type      Date                 Procedure    Measurement     Output
500   Initial    15 AUG 2017           Invasive        20            20/20
500   Initial    15 AUG 2017           Surface         35            35/35
500   Followup   15 AUG 2018          Invasive         54            54/20
428   Followup    15 AUG 2018         Outer            29            29/10
765   Seventh     3 AUG 2018          Other            13            13/19
500   Followup    3 JUL 2018          surface          98            98/35
428   Initial     3 JUL 2017          Outer            10            10/10
765   Initial     20 JUL 2019         Other            19            19/19
610   Third       20 AUG 2019         Invasive         66            66/17
610   Initial     17 Mar 2018         Invasive        17             17/17 ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Apr 2020 17:54:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Calculation-of-values-that-rely-on-a-date-variable/m-p/637316#M19078</guid>
      <dc:creator>AshJuri</dc:creator>
      <dc:date>2020-04-03T17:54:56Z</dc:date>
    </item>
    <item>
      <title>Re: Calculation of values that rely on a date variable</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Calculation-of-values-that-rely-on-a-date-variable/m-p/637324#M19079</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I am trying to calculate t&lt;/SPAN&gt;&lt;SPAN&gt;he value of the last&amp;nbsp;measurement&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;taken (according to the date column)&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I don't see this represented in your output table. It seems as if you are using the current measurement (not the last measurement taken) as the nuemrator.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is my code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc summary data=have nway;
	class subject procedure;
	var measurement;
	output out=stats min=min_measurement;
run;
proc sort data=have;
	by subject procedure;
run;
data want;
	merge have stats;
	by subject procedure;
	output = measurement/min_measurement;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 Apr 2020 17:58:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Calculation-of-values-that-rely-on-a-date-variable/m-p/637324#M19079</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-04-03T17:58:47Z</dc:date>
    </item>
  </channel>
</rss>

