<?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 check whether two variables are corresponding to each other in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-whether-two-variables-are-corresponding-to-each/m-p/756437#M238820</link>
    <description>&lt;P&gt;&amp;nbsp;SAS Pros,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am having a question that I want to check whether the two variables are corresponding to each other, which means if the value of 100 in variable1 corresponds to 10000 in variable 2, then that 100 will not correspond to other values in variable 2. The tricky thing is that when sorting variable 1 in an either ascending or descending way, variable 2 will be disorderly and may not continuous.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another questions is that I may have two or more observations under each ID, and each observation may have a different date. I want to whether the dates among the two or more observations under each ID are the same?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for any help!&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;C&lt;/P&gt;</description>
    <pubDate>Sun, 25 Jul 2021 00:39:38 GMT</pubDate>
    <dc:creator>CynthiaWei</dc:creator>
    <dc:date>2021-07-25T00:39:38Z</dc:date>
    <item>
      <title>How to check whether two variables are corresponding to each other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-whether-two-variables-are-corresponding-to-each/m-p/756437#M238820</link>
      <description>&lt;P&gt;&amp;nbsp;SAS Pros,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am having a question that I want to check whether the two variables are corresponding to each other, which means if the value of 100 in variable1 corresponds to 10000 in variable 2, then that 100 will not correspond to other values in variable 2. The tricky thing is that when sorting variable 1 in an either ascending or descending way, variable 2 will be disorderly and may not continuous.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another questions is that I may have two or more observations under each ID, and each observation may have a different date. I want to whether the dates among the two or more observations under each ID are the same?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for any help!&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;C&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jul 2021 00:39:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-whether-two-variables-are-corresponding-to-each/m-p/756437#M238820</guid>
      <dc:creator>CynthiaWei</dc:creator>
      <dc:date>2021-07-25T00:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to check whether two variables are corresponding to each other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-whether-two-variables-are-corresponding-to-each/m-p/756439#M238822</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/266374"&gt;@CynthiaWei&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm having a little trouble visualizing this.&amp;nbsp; Can you provide a sample of the data that you have and an example of the results you'd like to see?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jim&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jul 2021 01:22:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-whether-two-variables-are-corresponding-to-each/m-p/756439#M238822</guid>
      <dc:creator>jimbarbour</dc:creator>
      <dc:date>2021-07-25T01:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to check whether two variables are corresponding to each other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-whether-two-variables-are-corresponding-to-each/m-p/756440#M238823</link>
      <description>&lt;P&gt;Providing sample data via a SAS data step and then showing the desired result often helps tremendously in understanding the question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below an approach to answer your first question the way I understand it.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sample;
  do id=1 to 1000;
    var1=id;
    var2=id*10;
    output;
  end;
  var1+1;
  output;
  var2+1;
  output;
run;

title "var2 value with more than one corresponding var1 value";
proc sql;
  select 
    var2,
    count(distinct var1) as n_values    
  from sample
  group by var2
  having n_values ne 1
  ;
quit;
title;

title "var1 value with more than one corresponding var2 value";
proc sql;
  select 
    var1,
    count(distinct var2) as n_values    
  from sample
  group by var1
  having n_values ne 1
  ;
quit;
title;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1627176728807.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/61673iA82B8301B0611277/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1627176728807.png" alt="Patrick_0-1627176728807.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm not sure about your 2nd question. Please provide sample data and desired result. That should explain it.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jul 2021 01:43:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-whether-two-variables-are-corresponding-to-each/m-p/756440#M238823</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2021-07-25T01:43:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to check whether two variables are corresponding to each other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-whether-two-variables-are-corresponding-to-each/m-p/756468#M238839</link>
      <description>&lt;P&gt;Hi Patrick,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you so much for your codes!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Actually, I can apply your following codes to my 2nd question. It is still about checking whether same ID corresponds to multiple dates.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is very helpful!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;C&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jul 2021 10:25:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-whether-two-variables-are-corresponding-to-each/m-p/756468#M238839</guid>
      <dc:creator>CynthiaWei</dc:creator>
      <dc:date>2021-07-25T10:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to check whether two variables are corresponding to each other</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-check-whether-two-variables-are-corresponding-to-each/m-p/756469#M238840</link>
      <description>&lt;P&gt;Thank you JimBarbour all the same for checking in with me! I am sorry for the confusion. As I replied to Patrick, both my questions are solved.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;C&lt;/P&gt;</description>
      <pubDate>Sun, 25 Jul 2021 10:27:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-check-whether-two-variables-are-corresponding-to-each/m-p/756469#M238840</guid>
      <dc:creator>CynthiaWei</dc:creator>
      <dc:date>2021-07-25T10:27:48Z</dc:date>
    </item>
  </channel>
</rss>

