<?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: How to check variable for other row in sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842289#M333061</link>
    <description>&lt;P&gt;I want to find out which rows that are the same date in the previous rows and not same date. If all have the same date then i can use the max function to find maximal days of stay, if not the date are equals within the same ID and index_date, then i should take sum of days to find how many days there are in the health service.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do that?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;lag function only use the first rows and check for other rows, but this should stop when ID number changes.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Nov 2022 12:10:02 GMT</pubDate>
    <dc:creator>user40</dc:creator>
    <dc:date>2022-11-03T12:10:02Z</dc:date>
    <item>
      <title>How to check variable for other row in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842286#M333059</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to check variable for previous rows and asking how to do that. I should check if the previous rows are the same or the information is a new information for the same ID?&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 11:56:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842286#M333059</guid>
      <dc:creator>user40</dc:creator>
      <dc:date>2022-11-03T11:56:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to check variable for other row in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842288#M333060</link>
      <description>&lt;P&gt;There is the LAG function from which you can check specific variables to see what their values are in previous rows. There is FIRST. and LAST. which allows you to check certain things if the observations are grouped together.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You need to explain further what you are looking for, and give small examples.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 12:08:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842288#M333060</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-03T12:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to check variable for other row in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842289#M333061</link>
      <description>&lt;P&gt;I want to find out which rows that are the same date in the previous rows and not same date. If all have the same date then i can use the max function to find maximal days of stay, if not the date are equals within the same ID and index_date, then i should take sum of days to find how many days there are in the health service.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I do that?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;lag function only use the first rows and check for other rows, but this should stop when ID number changes.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 12:10:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842289#M333061</guid>
      <dc:creator>user40</dc:creator>
      <dc:date>2022-11-03T12:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to check variable for other row in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842291#M333062</link>
      <description>&lt;P&gt;Again, the request was to give some examples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I believe this can all be done, but given the descriptions you provided, I can't give example code, I'm not even 100% sure what you mean.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 12:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842291#M333062</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-03T12:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to check variable for other row in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842295#M333063</link>
      <description>&lt;P&gt;for example this example in the picture down here:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="table2.JPG" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/76907iBFC8A63643086B86/image-size/large?v=v2&amp;amp;px=999" role="button" title="table2.JPG" alt="table2.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here is ID =P000027284 information that I want to take maximum of stay, ID=P005253910 is two registration that I want to have on two rows, sum for the sequence 1 to 3 and max difference on sequence 4. In addition,&amp;nbsp;&lt;/P&gt;&lt;P&gt;sum the stay for ID=P000012625., You can see the data that I have on my server over here. I cannot send code. Must I use lag function for seq, tjtildato_refdager and other variables?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 12:26:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842295#M333063</guid>
      <dc:creator>user40</dc:creator>
      <dc:date>2022-11-03T12:26:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to check variable for other row in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842297#M333064</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/432803"&gt;@user40&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is ID =P000027284 information that I want to take maximum of stay,&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;What is the variable name of stay?&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ID=P005253910 is two registration that I want to have on two rows, sum for the sequence 1 to 3 and max difference on sequence 4.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Sum of what variable? Max difference of what variable? Difference between what 2 values? Why in one case you want sum and in the other case you want max difference? How do we know when to sum and when to difference?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Please, the problem needs much clearer and detailed description than what you have provided so far. Please describe the problem in detail&amp;nbsp;&lt;STRONG&gt;without reference to SAS coding methods.&lt;/STRONG&gt;&amp;nbsp;Please take some time and write a clear and complete explanation.&lt;/SPAN&gt;&lt;/P&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>Thu, 03 Nov 2022 12:39:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842297#M333064</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-03T12:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to check variable for other row in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842300#M333065</link>
      <description>&lt;P&gt;variable name of stay is daydiff that are shown in the picture. If there are stays that are overlapping then I want to take out max daydiff of the ID. If there are stays after each other then i need to sum the variable daydiff. In addition, I need to take sum stays when the registered more than one day after each other and take max stays for the other record.&amp;nbsp;&lt;/P&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>Thu, 03 Nov 2022 12:46:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842300#M333065</guid>
      <dc:creator>user40</dc:creator>
      <dc:date>2022-11-03T12:46:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to check variable for other row in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842307#M333071</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/432803"&gt;@user40&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;variable name of stay is daydiff that are shown in the picture. If there are stays that are overlapping then I want to take out max daydiff of the ID. If there are stays after each other then i need to sum the variable daydiff. In addition, I need to take sum stays when the registered more than one day after each other and take max stays for the other record.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't know how to determine if "stays are overlapping". I don't know how to determine if stays are after each other. I don't know how to determine when "the registered more than one day after each other".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm going to stop here. I can't work like this.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want you to write the entire problem clearly and completely, in one place. I do not want you to add a few more sentences to what you have previously written (which is what you are doing). I want the entire problem described in one place, with the data in the same place, so I don't have to scroll up and down to try to understand what you are talking about.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I also request that for the data you showed, you provide the desired output with explanation, which you can compute yourself without SAS and then type in the desired results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Nov 2022 13:16:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-variable-for-other-row-in-sas/m-p/842307#M333071</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-11-03T13:16:56Z</dc:date>
    </item>
  </channel>
</rss>

