<?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: Deriving a record value from multiple source datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Deriving-a-record-value-from-multiple-source-datasets/m-p/827151#M326717</link>
    <description>&lt;P&gt;I'd just use OUTPUT in a data step. Where the OUTPUT is placed does matter so test this carefully.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Simplistic example similar to your requirements, if anyone age 14 should have a new record with age 15 as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
output; *writes record to output data set;
if age = 14 then do;
*change age;
age=15;
output; *outputs record again;
end;
run;

title 'Original data set';
proc print data=sashelp.class;
run;

title 'New Data set';
proc print data=class;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 Aug 2022 15:44:43 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2022-08-04T15:44:43Z</dc:date>
    <item>
      <title>Deriving a record value from multiple source datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deriving-a-record-value-from-multiple-source-datasets/m-p/827140#M326711</link>
      <description>&lt;P&gt;&lt;FONT size="2"&gt;Hello,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;First time writing an ADDS Dataset&amp;nbsp;and came across this algorithm for deriving TCWRESOT. Brought in SDTM DS and merged with ADSL by subject ID. However came across an issue I need help with (I've highlighted the particular&amp;nbsp;problem)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;"If a subject has a record in SDTM.DS where DSSCAT equals "END OF TREATMENT" and DSDECOD is not equal to "COMPLETED", create a record with PARAMCD set to "TCWRESOT". If DSDECOD equals "OTHER" then set AVALC to "Other " concatenated with DSTERM enclosed in parenthesis. &lt;FONT color="#FFFF00"&gt;&lt;FONT color="#000000"&gt;Else, if DSDECOD equals "ADVERSE EVENT" then set AVALC to "Adverse event " &lt;FONT color="#FF0000"&gt;concatenated with the relevant (record where AE.AEACN equals "DRUG WITHDRAWN") AE.AETERM and AE.AEREL formatted in sentence case, enclosed in parenthesis and separated with a semicolon&lt;/FONT&gt;, for example "Adverse event (Headache; possibly related)"&lt;/FONT&gt;.&lt;/FONT&gt; Else, set AVALC to DSDECOD formatted in sentence case."&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;So just wondering&amp;nbsp;what the most efficient approach to this is. My initial&amp;nbsp;thoughts&amp;nbsp;are to subset the AE dataset where AEACN equals DRUG WITHDRAWN and concatenate AETERM and AEREL. Then subset the SDTM DS dataset where DSDECOD equals 'ADVERSE EVENT' them merge by subject and then possibly use PROC SQL to insert those concatenated values into a macro to bring into the current data step to use for that conditional&amp;nbsp;value&amp;nbsp;of&amp;nbsp;&amp;nbsp;TCWRESOT. If anyone has more experience or a more&amp;nbsp;efficient approach I would greatly appreciate it.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 14:58:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deriving-a-record-value-from-multiple-source-datasets/m-p/827140#M326711</guid>
      <dc:creator>smackerz1988</dc:creator>
      <dc:date>2022-08-04T14:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: Deriving a record value from multiple source datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deriving-a-record-value-from-multiple-source-datasets/m-p/827151#M326717</link>
      <description>&lt;P&gt;I'd just use OUTPUT in a data step. Where the OUTPUT is placed does matter so test this carefully.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Simplistic example similar to your requirements, if anyone age 14 should have a new record with age 15 as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data class;
set sashelp.class;
output; *writes record to output data set;
if age = 14 then do;
*change age;
age=15;
output; *outputs record again;
end;
run;

title 'Original data set';
proc print data=sashelp.class;
run;

title 'New Data set';
proc print data=class;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Aug 2022 15:44:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deriving-a-record-value-from-multiple-source-datasets/m-p/827151#M326717</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-08-04T15:44:43Z</dc:date>
    </item>
  </channel>
</rss>

