<?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: Check repetaed value in macro varible in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763176#M241685</link>
    <description>&lt;P&gt;Does the validation need to be case sensitive?&lt;/P&gt;
&lt;P&gt;Also it'd be nice if you'd fix the numerous typos in your post including the title and variable name.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to check repeted string in macro varible value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let chk_string= normal worst normal;&lt;/P&gt;
&lt;P&gt;%let chk_string2=normal worst worst;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need put warning message to log when macro valible CHK_SRING have repted string value like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put warning chk_string have repted value 'Normal';&lt;/P&gt;
&lt;P&gt;%put warning chk_string have repeted value 'worst';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can any one help on this one.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Mon, 23 Aug 2021 01:16:55 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2021-08-23T01:16:55Z</dc:date>
    <item>
      <title>Check repeated value in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763175#M241684</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to check repeted string in macro varible value.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let chk_string= normal worst normal;&lt;/P&gt;&lt;P&gt;%let chk_string2=normal worst worst;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I need put warning message to log when macro valible CHK_SRING have repted string value like below , no need to cehck case sensitivity&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%put warning chk_string have repted value 'Normal';&lt;/P&gt;&lt;P&gt;%put warning chk_string have repeted value 'worst';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;can any one help on this one.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Rajasekhar.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 01:24:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763175#M241684</guid>
      <dc:creator>raja777pharma</dc:creator>
      <dc:date>2021-08-23T01:24:42Z</dc:date>
    </item>
    <item>
      <title>Re: Check repetaed value in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763176#M241685</link>
      <description>&lt;P&gt;Does the validation need to be case sensitive?&lt;/P&gt;
&lt;P&gt;Also it'd be nice if you'd fix the numerous typos in your post including the title and variable name.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would like to check repeted string in macro varible value.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%let chk_string= normal worst normal;&lt;/P&gt;
&lt;P&gt;%let chk_string2=normal worst worst;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I need put warning message to log when macro valible CHK_SRING have repted string value like below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%put warning chk_string have repted value 'Normal';&lt;/P&gt;
&lt;P&gt;%put warning chk_string have repeted value 'worst';&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can any one help on this one.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Mon, 23 Aug 2021 01:16:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763176#M241685</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-23T01:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: Check repetaed value in macro varible</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763179#M241688</link>
      <description>Hi Chris,&lt;BR /&gt;&lt;BR /&gt;No need validate case sensitive.&lt;BR /&gt;Title updated.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 23 Aug 2021 01:25:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763179#M241688</guid>
      <dc:creator>raja777pharma</dc:creator>
      <dc:date>2021-08-23T01:25:46Z</dc:date>
    </item>
    <item>
      <title>Re: Check repeated value in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763184#M241689</link>
      <description>&lt;P&gt;Do it in a data step, and wrap the code into a macro for convenience:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let chk_string= normal worst normal;

%macro check_dup(string);
data _null_;
sec_string = "&amp;amp;string."; /* just to set the length */
sec_string = "";
do i = 1 to countw("&amp;amp;string.");
  sub_string = scan("&amp;amp;string.",i);
  if indexw(sec_string,strip(sub_string))
  then put "Warning " sub_string "is duplicated";
  else sec_string = catx(" ",sec_string,sub_string);
end;
run;
%mend;

%check_dup(&amp;amp;chk_string.)&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Aug 2021 07:40:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763184#M241689</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2021-08-23T07:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: Check repeated value in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763201#M241694</link>
      <description>&lt;P&gt;This works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let string= normal normal normal normal normal worst normal normal worst basic;

%macro t;
  %local string1 i word;
  %let string1=&amp;amp;string;
  %do i=1 %to %sysfunc(countw(%superq(string1)));
    %let word=%scan(&amp;amp;string1,&amp;amp;i);                      
    %let string1=%sysfunc(prxchange(s/\b&amp;amp;word\b//,1,&amp;amp;string1));                     
    %if ^%length(&amp;amp;string1) %then %return;
    %if %index(&amp;amp;string1,&amp;amp;word) %then %do ;                 
       %put ====&amp;gt; Word &amp;amp;word is duplicated.;                                                          
       %let string1=%sysfunc(prxchange(s/\b&amp;amp;word\b//,-1,&amp;amp;string1));
       %let i=1;
     %end;
  %end;
%mend;
%t&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;====&amp;gt; Word normal is duplicated.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;====&amp;gt; Word worst is duplicated.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Also it'd be very nice if you could fix the numerous typos in your post including the variable name.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Aug 2021 10:23:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763201#M241694</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2021-08-23T10:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Check repeated value in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763244#M241700</link>
      <description>&lt;PRE&gt;%let string= normal normal normal normal normal worst normal normal worst basic;

%macro t;
%let words=;
  %do i=1 %to %sysfunc(countw(&amp;amp;string));
    %let word=%scan(&amp;amp;string,&amp;amp;i);   
    %let s=%sysfunc(findw(&amp;amp;words,&amp;amp;word)); 

    %if  &amp;amp;s = 0  %then  	%let words=&amp;amp;words &amp;amp;word;
     %else  %put ====&amp;gt; Word &amp;amp;word is duplicated. ;  

  %end;
%mend;
%t&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Aug 2021 13:42:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763244#M241700</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2021-08-23T13:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Check repeated value in macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763246#M241701</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;Good answer.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Practice including a description of your approach along with the code. Perhaps something like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Process the list word by word and build a list of the distinct words found to use in testing for duplicates.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Remember to create LOCAL macro variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%local words i word s;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Aug 2021 14:18:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-repeated-value-in-macro-variable/m-p/763246#M241701</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-08-23T14:18:21Z</dc:date>
    </item>
  </channel>
</rss>

