<?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 get the missmatch values for timepoints that for the same formseq for a subject in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-missmatch-values-for-timepoints-that-for-the-same/m-p/731576#M227891</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ndsn;
infile datalines;
input timepoint formseq  usubjid $15.;
datalines;
1 1 111A116
1 1 111A116
1 1 111A116
5 5 111A116
4 5 111A116
5 5 111A116
8 8 111A116
8 8 111A116
6 6 111A116
6 6 111A116
3 6 111A116
;
run;
data want;
 do until(last.formseq);
  set ndsn;
  by  formseq notsorted;
  if first.formseq then _timepoint=timepoint;
  if _timepoint ne timepoint  then output;
 end;
 drop _timepoint;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 06 Apr 2021 12:21:47 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2021-04-06T12:21:47Z</dc:date>
    <item>
      <title>How to get the missmatch values for timepoints that for the same formseq for a subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-missmatch-values-for-timepoints-that-for-the-same/m-p/731553#M227878</link>
      <description>&lt;P&gt;I have a dataset where it is having multiple timepoints and multiple form sequence for the same subject id and i need to output those records where the form sequence is same for the subject but the timepoint is different, here as per the requirement if the form sequence is same for a subject the timepoint as as well must be same, if it is different it must be in the output. I have been trying with lag function and also using first. but i found that jot useful and not able to achieve the result. any help please.&lt;/P&gt;&lt;P&gt;example datasets as below&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ndsn;
infile datalines;
input timepoint formseq  usubjid $15.;
datalines;
1 1 111A116
1 1 111A116
1 1 111A116
5 5 111A116
4 5 111A116
5 5 111A116
8 8 111A116
8 8 111A116
6 6 111A116
6 6 111A116
3 6 111A116
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;expected output&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ndsn;
infile datalines;
input timepoint formseq  usubjid $15.;
datalines;
4 5 111A116
3 6 111A116
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I had tried lag function and also using first. but they didn't&amp;nbsp; provide expected result, i thought of using if then but that is taking long time, can i know a solution for this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 10:40:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-missmatch-values-for-timepoints-that-for-the-same/m-p/731553#M227878</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2021-04-06T10:40:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the missmatch values for timepoints that for the same formseq for a subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-missmatch-values-for-timepoints-that-for-the-same/m-p/731557#M227881</link>
      <description>&lt;P&gt;LAG and FIRST. are OK as an idea, it's how you implement them:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set ndsn;
by usubjid formseq notsorted;
retain flag;
if first.formseq then flag = 1;
if not first.formseq and timepoint ne lag(timepoint)
then do;
  if flag then output;
  flag = 0;
end;
drop flag;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Apr 2021 10:53:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-missmatch-values-for-timepoints-that-for-the-same/m-p/731557#M227881</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-06T10:53:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the missmatch values for timepoints that for the same formseq for a subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-missmatch-values-for-timepoints-that-for-the-same/m-p/731562#M227884</link>
      <description>Thanks a lot Kurt for a quick reply, it worked for me, i have got expected output now. Just for the purpose of knowledge, can i know the purpose of using notsorted</description>
      <pubDate>Tue, 06 Apr 2021 11:07:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-missmatch-values-for-timepoints-that-for-the-same/m-p/731562#M227884</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2021-04-06T11:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the missmatch values for timepoints that for the same formseq for a subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-missmatch-values-for-timepoints-that-for-the-same/m-p/731564#M227886</link>
      <description>&lt;P&gt;It is because in your example formseq 6 follows formseq 8. Which means that I either have to use the NOTSORTED option or use PROC SORT first to get the values in order.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Apr 2021 11:15:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-missmatch-values-for-timepoints-that-for-the-same/m-p/731564#M227886</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-04-06T11:15:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the missmatch values for timepoints that for the same formseq for a subject</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-missmatch-values-for-timepoints-that-for-the-same/m-p/731576#M227891</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ndsn;
infile datalines;
input timepoint formseq  usubjid $15.;
datalines;
1 1 111A116
1 1 111A116
1 1 111A116
5 5 111A116
4 5 111A116
5 5 111A116
8 8 111A116
8 8 111A116
6 6 111A116
6 6 111A116
3 6 111A116
;
run;
data want;
 do until(last.formseq);
  set ndsn;
  by  formseq notsorted;
  if first.formseq then _timepoint=timepoint;
  if _timepoint ne timepoint  then output;
 end;
 drop _timepoint;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Apr 2021 12:21:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-the-missmatch-values-for-timepoints-that-for-the-same/m-p/731576#M227891</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-04-06T12:21:47Z</dc:date>
    </item>
  </channel>
</rss>

