<?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 How to get an output for inconsistenc in a sequence number in a variable and other variable mismatch in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-an-output-for-inconsistenc-in-a-sequence-number-in-a/m-p/735888#M229249</link>
    <description>&lt;P&gt;I have got a requirement where i the variable is having multiple timepoints and they need to be in a sequence that were specified as per the specification and there are other two timepoint variables. here first i need to add a condition, if the sequence of first timepoint variable is not as per the order then the whole record must come in the output and also if the timepoint in either of the other&amp;nbsp; two variables(TP2, TP3) if it is not matching with the first one(TP1) then it should come in the output. I was able to achieve the second requirement but i am not able to find a solution for the first requirement. In the first requirement the sequence of TP1 variable should be (1,2,3,5,7,8,9,10,11) in this sequence 4 and 6 were missing as that will be present in other dataset. if this is not in sequence then it must be in output. Can someone please help.&lt;/P&gt;
&lt;P&gt;example dataset&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ndsn;
infile datalines;
input subject visit $4. TP1 TP2 TP3;
datalines;
101 Day1 1  1  1
101 Day1 2  4  2
101 Day1 3  2  3
101 Day1 5  4  5
101 Day1 7  7  7
101 Day1 8  8  8
101 Day1 9  8  9
101 Day1 10 10 10
101 Day1 11 10 11
101 Day2 1  1  1
101 Day2 2  4  2
101 Day2 5  2  3
101 Day2 3  4  5
101 Day2 5  7  7
101 Day2 8  8  8
101 Day2 7  8  9
101 Day2 10 10 10
101 Day2 8 10 11
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;desired output&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ndsn;
infile datalines;
input subject visit $4. TP1 TP2 TP3;
datalines;
101 Day1 2  4  2
101 Day1 3  2  3
101 Day1 5  4  5
101 Day1 9  8  9
101 Day1 11 10 11
101 Day2 2  4  2
101 Day2 5  2  3
101 Day2 3  4  5
101 Day2 5  7  7
101 Day2 7  8  9
101 Day2 8 10 11
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 21 Apr 2021 09:33:51 GMT</pubDate>
    <dc:creator>Ravindra_</dc:creator>
    <dc:date>2021-04-21T09:33:51Z</dc:date>
    <item>
      <title>How to get an output for inconsistenc in a sequence number in a variable and other variable mismatch</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-an-output-for-inconsistenc-in-a-sequence-number-in-a/m-p/735888#M229249</link>
      <description>&lt;P&gt;I have got a requirement where i the variable is having multiple timepoints and they need to be in a sequence that were specified as per the specification and there are other two timepoint variables. here first i need to add a condition, if the sequence of first timepoint variable is not as per the order then the whole record must come in the output and also if the timepoint in either of the other&amp;nbsp; two variables(TP2, TP3) if it is not matching with the first one(TP1) then it should come in the output. I was able to achieve the second requirement but i am not able to find a solution for the first requirement. In the first requirement the sequence of TP1 variable should be (1,2,3,5,7,8,9,10,11) in this sequence 4 and 6 were missing as that will be present in other dataset. if this is not in sequence then it must be in output. Can someone please help.&lt;/P&gt;
&lt;P&gt;example dataset&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ndsn;
infile datalines;
input subject visit $4. TP1 TP2 TP3;
datalines;
101 Day1 1  1  1
101 Day1 2  4  2
101 Day1 3  2  3
101 Day1 5  4  5
101 Day1 7  7  7
101 Day1 8  8  8
101 Day1 9  8  9
101 Day1 10 10 10
101 Day1 11 10 11
101 Day2 1  1  1
101 Day2 2  4  2
101 Day2 5  2  3
101 Day2 3  4  5
101 Day2 5  7  7
101 Day2 8  8  8
101 Day2 7  8  9
101 Day2 10 10 10
101 Day2 8 10 11
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;desired output&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data ndsn;
infile datalines;
input subject visit $4. TP1 TP2 TP3;
datalines;
101 Day1 2  4  2
101 Day1 3  2  3
101 Day1 5  4  5
101 Day1 9  8  9
101 Day1 11 10 11
101 Day2 2  4  2
101 Day2 5  2  3
101 Day2 3  4  5
101 Day2 5  7  7
101 Day2 7  8  9
101 Day2 8 10 11
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Apr 2021 09:33:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-an-output-for-inconsistenc-in-a-sequence-number-in-a/m-p/735888#M229249</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2021-04-21T09:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an output for inconsistenc in a sequence number in a variable and other variable mism</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-an-output-for-inconsistenc-in-a-sequence-number-in-a/m-p/735939#M229274</link>
      <description>&lt;P&gt;Use the RANGE function to detect if the results vary. If they don't, then remove them from the data set.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want_mm (drop = flag);
	set have;
	if range(of tp1-tp3) = 0 then flag = "1";
		else flag = "0";
	if flag = "0" then output;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs subject visit TP1 TP2 TP3 
1 101 Day1 2 4 2 
2 101 Day1 3 2 3 
3 101 Day1 5 4 5 
4 101 Day1 9 8 9 
5 101 Day1 11 10 11 
6 101 Day2 2 4 2 
7 101 Day2 5 2 3 
8 101 Day2 3 4 5 
9 101 Day2 5 7 7 
10 101 Day2 7 8 9 
11 101 Day2 8 10 11 
&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Apr 2021 12:41:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-an-output-for-inconsistenc-in-a-sequence-number-in-a/m-p/735939#M229274</guid>
      <dc:creator>maguiremq</dc:creator>
      <dc:date>2021-04-21T12:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to get an output for inconsistenc in a sequence number in a variable and other variable mism</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-get-an-output-for-inconsistenc-in-a-sequence-number-in-a/m-p/736360#M229382</link>
      <description>thanks for the help maguiremq</description>
      <pubDate>Thu, 22 Apr 2021 10:14:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-get-an-output-for-inconsistenc-in-a-sequence-number-in-a/m-p/736360#M229382</guid>
      <dc:creator>Ravindra_</dc:creator>
      <dc:date>2021-04-22T10:14:06Z</dc:date>
    </item>
  </channel>
</rss>

