<?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: Values the same in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664070#M198343</link>
    <description>Sorry I got an error message that array subscript out of range</description>
    <pubDate>Mon, 22 Jun 2020 21:16:03 GMT</pubDate>
    <dc:creator>Emma8</dc:creator>
    <dc:date>2020-06-22T21:16:03Z</dc:date>
    <item>
      <title>Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663701#M198187</link>
      <description>Hi. I have a large data with many variables. I would like to find out how many variables have the same values (all names are different), for example, but if missing info, then ignore). Also, the real data have texts strings, dates, and numeric variables)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Var1 var2 var3 var4 var5 var 6&lt;BR /&gt;1 a 4 6 a1&lt;BR /&gt;9 l 6 g ‘’ 5&lt;BR /&gt;8 d 5 y d&lt;BR /&gt;7 &amp;amp; 7 y ‘’ 6&lt;BR /&gt;&lt;BR /&gt;In this case the output should be var2 and var5 (second and last rows have missing info but ignored).&lt;BR /&gt;&lt;BR /&gt;Thank you.</description>
      <pubDate>Sat, 20 Jun 2020 14:03:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663701#M198187</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-06-20T14:03:33Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663714#M198190</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294547"&gt;@Emma8&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use PROC COMPARE to achieve this, along with the NOMISS option.&lt;/P&gt;
&lt;P&gt;- It can only compare pairs of variables &lt;U&gt;with the same type&lt;/U&gt;.&amp;nbsp;To select them, you can run the code twice, first with 'num' in PROC SQL, and then with 'char' as the type.&lt;/P&gt;
&lt;P&gt;- A PROC SQL and a MACRO are used to store all comparisons pairwise in macrovariables.&amp;nbsp;Typically,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;amp;var = &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;var1 var1 var1 var1 var2 var2 var2 var4 var4 var5&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;amp;with =&amp;nbsp;&lt;SPAN&gt;&amp;nbsp; var2 var4 var5 var6 var4 var5 var6 var5 var6 var6&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Output:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran 2020-06-20 à 17.50.54.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/46415i6E90C7B9A0F93144/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Capture d’écran 2020-06-20 à 17.50.54.png" alt="Capture d’écran 2020-06-20 à 17.50.54.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm=" "  dsd missover;
	input Var1 $ var2 $  var3 $ var4 $ var5 $ var6 $;
	datalines;
1 a 4 6 a 1
9 l 6 g l 5
8 d 5 y d
7 &amp;amp; 7 y  6
;

proc sql noprint;
	select name
	into:var1 -
	from dictionary.columns
	where libname = 'WORK' and memname = 'HAVE' and type = "char"; /*put either num or char*/
	
	select count(name)
	into:nb_var
	from dictionary.columns
	where libname = 'WORK' and memname = 'HAVE' and type = "char"; /*put either num or char*/
quit;

%global var with; 
%let var=;
%let with=;
%macro pairs;
	%local i j;
	%do i = 1 %to &amp;amp;nb_var;
		%do j = %eval(&amp;amp;i+1) %to &amp;amp;nb_var;
			%let var=&amp;amp;var &amp;amp;&amp;amp;var&amp;amp;i;
			%let with=&amp;amp;with &amp;amp;&amp;amp;var&amp;amp;j;
		%end;
    %end;
%mend pairs;
%pairs;

/* Report */
proc compare base=have listequalvar novalues nomiss;
	var &amp;amp;var;
	with &amp;amp;with;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;NB: you can leverage the following material to go one step further:&amp;nbsp;&lt;A href="https://support.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2018/1654-2018.pdf" target="_blank" rel="noopener"&gt;https://support.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2018/1654-2018.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jun 2020 16:05:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663714#M198190</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-06-20T16:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663721#M198194</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm=" "  dsd missover;
	input Var1 $ var2 $  var3 $ var4 $ var5 $ var6 $;
	length similar_char_vars similar_num_vars $32767.;
	array _c{*} _character_;
	array _n{*} _numeric_;
	
	do i = 1 to dim(_c);
	similar_char_vars='';
	do j= i+1 to dim(_c);
	   if _c[i] = _c[j] and not missing(_c[i])then similar_char_vars = strip(similar_char_vars)||' '||vname(_c[i])||' '||vname(_c[j])||' '||strip(_c[j]);
	end;
	if ^missing(similar_char_vars) then output;
	end;

	do i = 1 to dim(_c);
	similar_num_vars='';
	do j= i+1 to dim(_c);
	   if _c[i] = _c[j] and not missing(_c[i])then similar_num_vars = strip(similar_num_vars)||' '||vname(_c[i])||' '||vname(_c[j])||' '||strip(_c[j]);
	end;
	if ^missing(similar_char_vars) then output;
	end;
	drop i j;
	put similar_char_vars=;
	datalines;;
1 a 4 6 a 1
9 l 6 g l 5
8 d 5 y d  
7 &amp;amp; 7 y   6
;;;
run;


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 20 Jun 2020 16:27:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663721#M198194</guid>
      <dc:creator>smantha</dc:creator>
      <dc:date>2020-06-20T16:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663733#M198204</link>
      <description>&lt;P&gt;Having an array &lt;STRONG&gt;X&lt;/STRONG&gt; you can sort it by value using&amp;nbsp;&lt;STRONG&gt;CALL SORTN(OF X[*])&lt;/STRONG&gt;; for numeric variables&lt;/P&gt;
&lt;P&gt;or &lt;STRONG&gt;SORTC&lt;/STRONG&gt; for character variables.&lt;/P&gt;
&lt;P&gt;After sort just compare value of x(i) with x(i+1) to check for same values,&lt;/P&gt;
&lt;P&gt;then get var names using function &lt;STRONG&gt;VNAME(X(i))&lt;/STRONG&gt;;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jun 2020 17:55:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663733#M198204</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-06-20T17:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663736#M198205</link>
      <description>Thanks, but the output is not what I want to. I want only get var2 and var5 (compare all obs except missing).</description>
      <pubDate>Sat, 20 Jun 2020 18:03:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663736#M198205</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-06-20T18:03:28Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663738#M198207</link>
      <description>&lt;P&gt;You may try next code:&lt;/P&gt;
&lt;PRE&gt;/* starting code the same as of @smantha */&lt;BR /&gt;data have;&lt;BR /&gt;infile datalines dlm=" " dsd missover;&lt;BR /&gt;input Var1 $ var2 $ var3 $ var4 $ var5 $ var6 $;&lt;BR /&gt;length similar_char_vars similar_num_vars $32767.;&lt;BR /&gt;array _c{*} _character_;&lt;BR /&gt;array _n{*} _numeric_;&lt;BR /&gt;&lt;BR /&gt;call sortN(_n(*));&lt;BR /&gt;call sortC(_c(*));&lt;BR /&gt;&lt;BR /&gt;do i=1 to dim(_c)-1;&lt;BR /&gt;if _c(i) = _c(i+1) then put _N_= vname(_c(i)) vanme(_c(i+1));&lt;BR /&gt;end;&lt;BR /&gt;&lt;BR /&gt;do i=1 to dim(_n)-1;&lt;BR /&gt;if _n(i) = _n(i+1) then put _N_= vname(_n(i)) vanme(_n(i+1));&lt;BR /&gt;end;&lt;BR /&gt;datalines;;&lt;BR /&gt;1 a 4 6 a 1&lt;BR /&gt;9 l 6 g l 5&lt;BR /&gt;8 d 5 y d &lt;BR /&gt;7 &amp;amp; 7 y 6&lt;BR /&gt;;;;&lt;BR /&gt;run;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 20 Jun 2020 18:19:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663738#M198207</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-06-20T18:19:39Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663839#M198244</link>
      <description>Hi. Can you first create the have data and then write the code? I mean I have another huge sas data data I cannot use infile -when I remove and use my data —it has a warning “undefined array -also line call and column undetermined for call sortn...&lt;BR /&gt;Thank you.</description>
      <pubDate>Sun, 21 Jun 2020 13:06:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663839#M198244</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-06-21T13:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663857#M198257</link>
      <description>&lt;P&gt;Sorry, I tested the code and unfortunately some documented code did not work for me:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; neither &lt;EM&gt;CALL SORTC&lt;/EM&gt;(array_name(*));&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; nor&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;EM&gt;CALL SORTN&lt;/EM&gt;(array_name(*));&lt;/P&gt;
&lt;P&gt;It seems that those procedures requires list of variable names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another issue found - after sorting the array the VNAME doesn't show the right&lt;/P&gt;
&lt;P&gt;variable name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I had some other issues, so please ignore that code.&lt;/P&gt;
&lt;P&gt;I intend to open a new query to point those issues ans ask for future upgrade.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Shmuel&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jun 2020 17:49:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663857#M198257</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-06-21T17:49:24Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663881#M198274</link>
      <description>I got an warning message -text character over 60000 and truncated. I wonder how can do all about 500 variables with start prefix t_ against all variables over 100 variables with s_? All variables with prefix t_ by batch (5 variables at once with all the 100 variables s_)?</description>
      <pubDate>Sun, 21 Jun 2020 21:26:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663881#M198274</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-06-21T21:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663944#M198303</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294547"&gt;@Emma8&lt;/a&gt;, after hard work and discussion made in the forum, next code uses&amp;nbsp;&lt;EM&gt;call sortC &lt;/EM&gt;with &lt;EM&gt;vname &lt;/EM&gt;fuction&lt;/P&gt;
&lt;P&gt;to bring wanted results.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code is tested:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	infile datalines dlm=" "  dsd missover;
	input Var1 $ var2 $  var3 $ var4 $ var5 $ var6 $;
datalines;;
1 a 4 6 a 1
9 l 6 g l 5
8 d 5 y d  
7 &amp;amp; 7 y   6
;;;
run;

data _null_;
 set have;
     array _c {*} _character_;
     array _n {*} _numeric_ ;
     call symput('nvarC', left(dim(_c)));
     call symput('nvarN', left(dim(_n)));
run;
%put nvarC = &amp;amp;nvarC;
%put nvarN = &amp;amp;nvarN;

data want(drop=i );	
 set have;
     dlm = '10'x;   /* any none expected character in values may be used as delimiter */
     fmt = '$char2.'; /* force keep leading spaces */
     array _BEFORE  {*} _character_;
     nvarc = dim(_BEFORE);    
     array _NAMES {&amp;amp;nvarC} $10. _vnm1 - _vnm&amp;amp;nvarC;
     array _temp  {&amp;amp;nvarC} $20. _tmp1 - _tmp&amp;amp;nvarC;
 
     do i=1 to &amp;amp;nvarC;
        _names(i) = vname(_BEFORE(i));
        _temp(i) = catx(dlm, putc(_BEFORE(i), fmt), i );
     end;

	call sortC(of _temp(*));  
	
	do i=1 to dim(_temp)-1;
	   j=i+1;
	   value1 = scan(_temp(i),1, dlm);
	   value2 = scan(_temp(j),1, dlm);
	   if value1 = value2 then do;
	      ix1 = scan(_temp(i),2, dlm);
	      v1  = _names(ix1);
	      ix2 = scan(_temp(j),2, dlm);
	      v2  = _names(ix2);
	      put _N_= v1= v2= value1= value2= ;
	   end;
	end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;U&gt;output in log shows&lt;/U&gt;:&lt;/P&gt;
&lt;DIV class="sasSource"&gt;_N_=1 v1=Var1 v2=var6 value1=1 value2=1&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;_N_=1 v1=var2 v2=var5 value1=a value2=a&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;_N_=2 v1=var2 v2=var5 value1=l value2=l&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;_N_=3 v1=var2 v2=var5 value1=d value2=d&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;_N_=4 v1=Var1 v2=var3 value1=7 value2=7&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;In case you are interested in the forum discussion, it is in the next link:&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&lt;A href="https://communities.sas.com/t5/SAS-Programming/Please-improve-call-sortc-sortn-procedures-and-vname-function/m-p/663906/highlight/false#M198291" target="_self"&gt;https://communities.sas.com/t5/SAS-Programming/Please-improve-call-sortc-sortn-procedures-and-vname-function/m-p/663906/highlight/false#M198291&lt;/A&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="sasSource"&gt;The code may be adapted to any required output format.&lt;/DIV&gt;</description>
      <pubDate>Mon, 22 Jun 2020 10:37:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/663944#M198303</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-06-22T10:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664070#M198343</link>
      <description>Sorry I got an error message that array subscript out of range</description>
      <pubDate>Mon, 22 Jun 2020 21:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664070#M198343</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-06-22T21:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664078#M198348</link>
      <description>&lt;P&gt;Would you please post the full log.&lt;/P&gt;
&lt;P&gt;I shall check and repair where need.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 22:07:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664078#M198348</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-06-22T22:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664079#M198349</link>
      <description>Nvarc=253&lt;BR /&gt;Nvarn=415&lt;BR /&gt;&lt;BR /&gt;Also I changed dlm=“|”&lt;BR /&gt;( I have commas and open quotes in my text strings that I do not want to create separate variables from what I have—no | in my string)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Then it gives array subscript out of range at line 18565 column 17</description>
      <pubDate>Mon, 22 Jun 2020 22:16:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664079#M198349</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-06-22T22:16:56Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664082#M198351</link>
      <description>Sorry I changed the length format and seems running now!:) thank you</description>
      <pubDate>Mon, 22 Jun 2020 22:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664082#M198351</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-06-22T22:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664087#M198354</link>
      <description>Sorry it does not work —I removed variables with Length more than 900 characters. &lt;BR /&gt;Now I have &lt;BR /&gt;240 character and 415 numeric variables. &lt;BR /&gt;Still out of range array error message. &lt;BR /&gt;Could you fix the code without using dlm and force leading spaces ? I mean I used complb to compress all extra spaces</description>
      <pubDate>Mon, 22 Jun 2020 22:42:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664087#M198354</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-06-22T22:42:48Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664110#M198365</link>
      <description>I think it gives an error (array out of range) if variables length were longer than certain limit (perhaps 20).</description>
      <pubDate>Tue, 23 Jun 2020 01:13:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664110#M198365</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-06-23T01:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664127#M198370</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/294547"&gt;@Emma8&lt;/a&gt;&amp;nbsp;, are you comparing the char type variables only or both numeric and character?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll be glad to help you fix the code but I need see the full log:&lt;/P&gt;
&lt;P&gt;I need see all adaptations done to the code, warning and error messages,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;especially messages concerning "out of range at line ##### column ##" - because&lt;/P&gt;
&lt;P&gt;line in log is not the same line in code and it changes per run. Usually such message&lt;/P&gt;
&lt;P&gt;displays all variables values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;copy the full log into the &amp;lt;/&amp;gt; icon-window&amp;nbsp; and post it.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 03:39:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664127#M198370</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-06-23T03:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664237#M198405</link>
      <description>Thank you. &lt;BR /&gt;I am comparing numeric only with numeric etc. &lt;BR /&gt;it gives an error at _n_=7—when I remove some variables then it gives an error at different, for example, _n_=139</description>
      <pubDate>Tue, 23 Jun 2020 11:22:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664237#M198405</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-06-23T11:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664431#M198493</link>
      <description>&lt;P&gt;Without seeing the log I can only guess.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) Pay attention that macro variable &amp;amp;nvarN is the number of all numeric variables in your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; When you omit some variables - depending on which line code or which data step - you may cause&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; the index i point over the end of the array, thus resulting in "...&amp;nbsp;&lt;SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;array subscript out of range at line&lt;/STRONG&gt; &lt;/FONT&gt;..." error.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;2) When you get such error message, the given line number points to the log line where the error&amp;nbsp;&lt;/SPAN&gt;occurred.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; It is important to check the code and the do loop in the program, containing the same code as in the log.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Sometimes such error may be the result of overriding the index i inside the loop.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want me to continue help with that code, supply the &lt;STRONG&gt;full log&lt;/STRONG&gt; in the next post.&lt;/P&gt;
&lt;P&gt;If you prefer to struggle the code by yourself, I wish you&amp;nbsp; success and appreciate it vary much.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, if you compare only numeric variables, why have you post a test sample of character variables ?!&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 18:29:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664431#M198493</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-06-23T18:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Values the same</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664439#M198497</link>
      <description>Thanks. &lt;BR /&gt;It runs without any warning -but _n_=7 or others it gives the error message —that is the only error message and stops running. &lt;BR /&gt;I want to compare numeric data with numeric and character data with character variables</description>
      <pubDate>Tue, 23 Jun 2020 18:59:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Values-the-same/m-p/664439#M198497</guid>
      <dc:creator>Emma8</dc:creator>
      <dc:date>2020-06-23T18:59:01Z</dc:date>
    </item>
  </channel>
</rss>

