<?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: I want to do Roll up and Roll down by my interest in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-do-Roll-up-and-Roll-down-by-my-interest/m-p/892850#M352677</link>
    <description>&lt;P&gt;How I would approach it:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;in a DATA step, create two datasets (ans1 and ans2), both containing id and new variable test&lt;/LI&gt;
&lt;LI&gt;loop through the test1 variable (COUNTW and SCAN functions), and write to ans1 if test is in A,B,C or to ans2 if not&lt;/LI&gt;
&lt;LI&gt;sort both dataset by id and test with NODUPKEY to remove duplicates&lt;/LI&gt;
&lt;LI&gt;in two final DATA steps, concatenate the tests (use BY, FIRST. and LAST., RETAIN, CATX)&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Wed, 06 Sep 2023 06:52:51 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2023-09-06T06:52:51Z</dc:date>
    <item>
      <title>I want to do Roll up and Roll down by my interest</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-do-Roll-up-and-Roll-down-by-my-interest/m-p/892844#M352672</link>
      <description>&lt;P&gt;Consider the dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Data Exam;&lt;/P&gt;&lt;P&gt;format exam_date date9.;&lt;BR /&gt;informat exam_date date9.;&lt;/P&gt;&lt;P&gt;Input ID $ exam_date Test1 $;&lt;BR /&gt;Datalines;&lt;BR /&gt;9000001 01JAN2023&amp;nbsp; &amp;nbsp; A,B&lt;BR /&gt;9000001 15FEB2023&amp;nbsp; &amp;nbsp; &amp;nbsp; D,B&lt;BR /&gt;9000001 20MAR2023&amp;nbsp; &amp;nbsp;E,C&lt;/P&gt;&lt;P&gt;9000003 15FEB2023&amp;nbsp; &amp;nbsp; &amp;nbsp; D,B&lt;BR /&gt;9000003 20MAR2023&amp;nbsp; &amp;nbsp;F,C&lt;/P&gt;&lt;P&gt;9000004 20MAR2023&amp;nbsp; &amp;nbsp;B&lt;/P&gt;&lt;P&gt;9000004 20MAR2023&amp;nbsp; &amp;nbsp;G&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;answer1 condition if patient containing A, B, C then only those should in final dataset&lt;/P&gt;&lt;P&gt;my answer1 should be&lt;/P&gt;&lt;P&gt;9000001 A+B+C&lt;/P&gt;&lt;P&gt;9000003 B+C&lt;/P&gt;&lt;P&gt;9000004&amp;nbsp; &amp;nbsp;B&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;answer2 condition if patient containing other then A, B, C then only those should in final dataset&lt;/P&gt;&lt;P&gt;my answer2 should be&lt;/P&gt;&lt;P&gt;9000001 D+E&lt;/P&gt;&lt;P&gt;9000003 D+F&lt;/P&gt;&lt;P&gt;9000004 G&lt;BR /&gt;&lt;BR /&gt;please write a code that will help to achieve this result&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 06:12:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-do-Roll-up-and-Roll-down-by-my-interest/m-p/892844#M352672</guid>
      <dc:creator>carl_miles</dc:creator>
      <dc:date>2023-09-06T06:12:01Z</dc:date>
    </item>
    <item>
      <title>Re: I want to do Roll up and Roll down by my interest</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-do-Roll-up-and-Roll-down-by-my-interest/m-p/892846#M352674</link>
      <description>&lt;P&gt;Looks like some kind of homework or exam. What have you tried so far?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 06:43:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-do-Roll-up-and-Roll-down-by-my-interest/m-p/892846#M352674</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-06T06:43:35Z</dc:date>
    </item>
    <item>
      <title>Re: I want to do Roll up and Roll down by my interest</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-do-Roll-up-and-Roll-down-by-my-interest/m-p/892847#M352675</link>
      <description>&lt;P&gt;There are many ways to create the datasets you need. But i don't think that posting a solution will help you to solve tasks in the future. So, what have you tried?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 06:42:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-do-Roll-up-and-Roll-down-by-my-interest/m-p/892847#M352675</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2023-09-06T06:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: I want to do Roll up and Roll down by my interest</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-do-Roll-up-and-Roll-down-by-my-interest/m-p/892849#M352676</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As others have said, sharing what you have tried will help both you and us. I would also advise sharing the log if you have run the code, including any notes, warnings, or error messages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please use the Insert Code icon "&amp;lt;/&amp;gt;" when posting code or log content.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Sep 2023 06:50:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-do-Roll-up-and-Roll-down-by-my-interest/m-p/892849#M352676</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2023-09-06T06:50:07Z</dc:date>
    </item>
    <item>
      <title>Re: I want to do Roll up and Roll down by my interest</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-want-to-do-Roll-up-and-Roll-down-by-my-interest/m-p/892850#M352677</link>
      <description>&lt;P&gt;How I would approach it:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;in a DATA step, create two datasets (ans1 and ans2), both containing id and new variable test&lt;/LI&gt;
&lt;LI&gt;loop through the test1 variable (COUNTW and SCAN functions), and write to ans1 if test is in A,B,C or to ans2 if not&lt;/LI&gt;
&lt;LI&gt;sort both dataset by id and test with NODUPKEY to remove duplicates&lt;/LI&gt;
&lt;LI&gt;in two final DATA steps, concatenate the tests (use BY, FIRST. and LAST., RETAIN, CATX)&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Wed, 06 Sep 2023 06:52:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-want-to-do-Roll-up-and-Roll-down-by-my-interest/m-p/892850#M352677</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-09-06T06:52:51Z</dc:date>
    </item>
  </channel>
</rss>

