<?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 using CNTLIN or resolution for VLookup in SAS in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/using-CNTLIN-or-resolution-for-VLookup-in-SAS/m-p/811360#M33909</link>
    <description>&lt;DIV&gt;I am new to CNTLIN and tried to make use of it and failed.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have the following table&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SSN&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;COMP_SSN&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and I have to create then new column&amp;nbsp;&lt;FONT color="#ff0000"&gt;MULTI_FLAG&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;Where the combination of SSN &amp;amp; COMP_SSN is repeated,&amp;nbsp; then the entire ID row has to be tagged as Y.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;data DS_To_Flag;&lt;BR /&gt;input ID SSN $ COMP_SSN $;&lt;BR /&gt;datalines;&lt;BR /&gt;123 999 0&lt;BR /&gt;333 666 987&lt;BR /&gt;444 765 0&lt;BR /&gt;9996 987 0&lt;BR /&gt;876 8889 999&lt;BR /&gt;777 8889 0&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;e.g: For the row where ID = 333 -&amp;gt; SSN of 666 is unique, while COMP_SSN of 987--- the same 987 does exist in SSN List...hence Multi_flag will be Y..&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;*Wanted Column -&amp;gt; MULTI_FLAG&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; SSN&amp;nbsp; &amp;nbsp; COMP_SSN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MULTI_FLAG&lt;BR /&gt;123&amp;nbsp; &amp;nbsp; 999&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y&lt;BR /&gt;333&amp;nbsp; &amp;nbsp; 666&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;987&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y&lt;BR /&gt;444&amp;nbsp; &amp;nbsp; 765&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; N&lt;BR /&gt;9996&amp;nbsp; 987&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y&lt;BR /&gt;876&amp;nbsp; &amp;nbsp; 8889&amp;nbsp; &amp;nbsp; &amp;nbsp;999&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y&lt;BR /&gt;777&amp;nbsp; &amp;nbsp; 8889&amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;I am trying to achieve this by CNTL... &lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;IF not please suggest the resolution in creating the new MULTI_FLAG&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;* I need the new flag column as Multi_Flag&lt;/DIV&gt;</description>
    <pubDate>Wed, 04 May 2022 11:50:19 GMT</pubDate>
    <dc:creator>pdata</dc:creator>
    <dc:date>2022-05-04T11:50:19Z</dc:date>
    <item>
      <title>using CNTLIN or resolution for VLookup in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-CNTLIN-or-resolution-for-VLookup-in-SAS/m-p/811360#M33909</link>
      <description>&lt;DIV&gt;I am new to CNTLIN and tried to make use of it and failed.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I have the following table&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;ID&lt;/STRONG&gt;,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;SSN&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;COMP_SSN&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and I have to create then new column&amp;nbsp;&lt;FONT color="#ff0000"&gt;MULTI_FLAG&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;Where the combination of SSN &amp;amp; COMP_SSN is repeated,&amp;nbsp; then the entire ID row has to be tagged as Y.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;data DS_To_Flag;&lt;BR /&gt;input ID SSN $ COMP_SSN $;&lt;BR /&gt;datalines;&lt;BR /&gt;123 999 0&lt;BR /&gt;333 666 987&lt;BR /&gt;444 765 0&lt;BR /&gt;9996 987 0&lt;BR /&gt;876 8889 999&lt;BR /&gt;777 8889 0&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;e.g: For the row where ID = 333 -&amp;gt; SSN of 666 is unique, while COMP_SSN of 987--- the same 987 does exist in SSN List...hence Multi_flag will be Y..&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;*Wanted Column -&amp;gt; MULTI_FLAG&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;ID&amp;nbsp; &amp;nbsp; &amp;nbsp; SSN&amp;nbsp; &amp;nbsp; COMP_SSN&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MULTI_FLAG&lt;BR /&gt;123&amp;nbsp; &amp;nbsp; 999&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y&lt;BR /&gt;333&amp;nbsp; &amp;nbsp; 666&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;987&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Y&lt;BR /&gt;444&amp;nbsp; &amp;nbsp; 765&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; N&lt;BR /&gt;9996&amp;nbsp; 987&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y&lt;BR /&gt;876&amp;nbsp; &amp;nbsp; 8889&amp;nbsp; &amp;nbsp; &amp;nbsp;999&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y&lt;BR /&gt;777&amp;nbsp; &amp;nbsp; 8889&amp;nbsp; &amp;nbsp; 0&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Y&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;I am trying to achieve this by CNTL... &lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000"&gt;IF not please suggest the resolution in creating the new MULTI_FLAG&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;* I need the new flag column as Multi_Flag&lt;/DIV&gt;</description>
      <pubDate>Wed, 04 May 2022 11:50:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-CNTLIN-or-resolution-for-VLookup-in-SAS/m-p/811360#M33909</guid>
      <dc:creator>pdata</dc:creator>
      <dc:date>2022-05-04T11:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: using CNTLIN or resolution for VLookup in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-CNTLIN-or-resolution-for-VLookup-in-SAS/m-p/811370#M33911</link>
      <description>&lt;P&gt;Please provide data in usable form: a data step using datalines or proc sql with insert.&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 06:09:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-CNTLIN-or-resolution-for-VLookup-in-SAS/m-p/811370#M33911</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-05-04T06:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: using CNTLIN or resolution for VLookup in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-CNTLIN-or-resolution-for-VLookup-in-SAS/m-p/811415#M33913</link>
      <description>Thank you Andreas_Ids... my bad..&lt;BR /&gt;However, I have updated the post and added the Dataset block for the sample Data.</description>
      <pubDate>Wed, 04 May 2022 11:52:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-CNTLIN-or-resolution-for-VLookup-in-SAS/m-p/811415#M33913</guid>
      <dc:creator>pdata</dc:creator>
      <dc:date>2022-05-04T11:52:17Z</dc:date>
    </item>
    <item>
      <title>Re: using CNTLIN or resolution for VLookup in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-CNTLIN-or-resolution-for-VLookup-in-SAS/m-p/811420#M33914</link>
      <description>&lt;P&gt;A CNTLIN dataset would just be a way to define a format.&amp;nbsp; Please show what format you would define for given example and how you would use it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not sure I get the logic here.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is the goal to flag any observation where either SSN that has more than one ID associated with it?&lt;/P&gt;
&lt;P&gt;So perhaps just find the SSN that have multiple IDs associated and make for format that just has those values of SSN?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data DS_To_Flag;
input ID SSN $ COMP_SSN $;
datalines;
123 999 0
333 666 987
444 765 0
9996 987 0
876 8889 999
777 8889 0
;

proc transpose data=ds_to_flag out=ssn(rename=(col1=ssn) where=(ssn not in ('0',' '))) name=type ;
  by id notsorted;
  var ssn comp_ssn;
run;

proc print;
run;

proc sql ;
create table cntlin as
  select 'ssndup' as fmtname
       , 'C' as type
       , ssn as start
       , 'Y' as label
  from ssn
  group by 1,2,3,4
  having count(*) &amp;gt; 1
;
quit;

proc format cntlin=cntlin fmtlib;
run;

data want ;
  set ds_to_flag;
  if put(ssn,$ssndup.)='Y' or put(comp_ssn,$ssndup.)='Y' then multi_flag='Y';
  else multi_flag='N';
run;

proc print;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 12:12:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-CNTLIN-or-resolution-for-VLookup-in-SAS/m-p/811420#M33914</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-05-04T12:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: using CNTLIN or resolution for VLookup in SAS</title>
      <link>https://communities.sas.com/t5/New-SAS-User/using-CNTLIN-or-resolution-for-VLookup-in-SAS/m-p/811426#M33915</link>
      <description>&lt;P&gt;&lt;BR /&gt;Thank You Tom..&lt;BR /&gt;&lt;BR /&gt;Yes, the resolution provided did work very well...you got the logic right.&lt;BR /&gt;ID is unique and however, the value of SSN having found multiples either in SSN or COMP_SSN...or COMP_SSN having found multiples either in SSN or COMP_SSN then the Multi_Flag is Y..&lt;BR /&gt;&lt;BR /&gt;I never had success using CNTLIN and your steps did make me understand it and Data Transpose is which I never though off..&lt;BR /&gt;&lt;BR /&gt;Tom, thank you so much... You made it very clear.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 04 May 2022 12:45:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/using-CNTLIN-or-resolution-for-VLookup-in-SAS/m-p/811426#M33915</guid>
      <dc:creator>pdata</dc:creator>
      <dc:date>2022-05-04T12:45:10Z</dc:date>
    </item>
  </channel>
</rss>

