<?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: SAS code to create a report where the Special Character are been entered in all datasets in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964625#M375664</link>
    <description>Yes, if I use the data step then the records in the report doesn't have any invalid characters but they're still generated in the report.&lt;BR /&gt;&lt;BR /&gt;I think in this case where step is best option and i may need to manually adjust the variables</description>
    <pubDate>Fri, 18 Apr 2025 19:08:40 GMT</pubDate>
    <dc:creator>possible</dc:creator>
    <dc:date>2025-04-18T19:08:40Z</dc:date>
    <item>
      <title>SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964593#M375646</link>
      <description>&lt;P&gt;Thank you for taking time to review my question and Greatly appreciate your time and effort on this.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Need to create a report if datasets have one more special characters are been entered in same cell or if entered in the one more columns in the datasets. I have 15 datasets where i would need to repeat this to find the special characters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The report should contain all the entire row of dataset. if special character is records.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Allowed characters: all small &amp;amp; uppercase letters, numbers and&amp;nbsp;&lt;SPAN&gt;[]{}()!?/,.%+@$&amp;amp;*:=^_-\";&amp;lt;&amp;gt;~# ’ ≥ ≤ and ' ' space.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Example characters entered in the dataset is "Ⅱ、Ⅲ、vf、at、on。"&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Where "、" is special character and the row should be printed.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 18:29:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964593#M375646</guid>
      <dc:creator>possible</dc:creator>
      <dc:date>2025-04-18T18:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964594#M375647</link>
      <description>&lt;P&gt;Sounds like you want the VERIFY() function (or perhaps KVERIFY() since you seem to want to accept some characters that are not 7bit ASCII codes)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to test whether any bytes in a character variable are not normal ASCII codes then you could use the range of codes from space to tilde.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=mydata;
  where verify(mycol,collate(32,126));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you want to allow things like&amp;nbsp;&amp;nbsp;≥ ≤ then you are not using a single byte encoding and so will need to use KVERIFY() instead.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=mydata;
  where kverify(mycol,collate(32,126)||'E289A5E289A4'x);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to test multiple variables use cats() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc print data=mydata;
  where verify(cats(vara,varb,mycol),collate(32,126));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;To test all of the variables might be easier to use a data step so you could use variable list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data report;
  set mydata;
  if verify(cats(of _character_),collate(32,126));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Apr 2025 15:04:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964594#M375647</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-04-18T15:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964603#M375652</link>
      <description>kverify step seems working fine as expected but one small issue is if the data has any space after the comma then the code is printing that data as well and how can I include all the variables instead of manually adding them. Can I use _all_ or any other function at mycol ?&lt;BR /&gt;&lt;BR /&gt;example: device，The day was today</description>
      <pubDate>Fri, 18 Apr 2025 16:50:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964603#M375652</guid>
      <dc:creator>possible</dc:creator>
      <dc:date>2025-04-18T16:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964613#M375657</link>
      <description>&lt;P&gt;That is probably NOT an actual space.&amp;nbsp; Might be a non-breaking space which is normally 'A0'x in single byte encodings and should be 'C2A0'x in UTF-8 encoding.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You cannot use variable lists in WHERE.&amp;nbsp; That is why I suggested using a data step so you could use an IF statement instead.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 17:21:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964613#M375657</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-04-18T17:21:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964622#M375661</link>
      <description>Make senses but in the data step, alot of incorrect data has been printed.</description>
      <pubDate>Fri, 18 Apr 2025 18:28:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964622#M375661</guid>
      <dc:creator>possible</dc:creator>
      <dc:date>2025-04-18T18:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964623#M375662</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/443420"&gt;@possible&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Make senses but in the data step, alot of incorrect data has been printed.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Not sure what you mean.&amp;nbsp; Are you getting errors when running the data step? Or are you records selected that do not appear to have any invalid characters?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;SAS might not like running CATS() on a lot of long variables since the result might be too long.&amp;nbsp; You might need to work a little harder.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data report;
  set have;
  any=0;
  array _char_ _character_;
  do _n_=1 to dim(_char_) while (not any);
     any = kverify(_char_[_n_],collate(32,126)||'C2A0'x);
  end;
  if any;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 18 Apr 2025 18:36:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964623#M375662</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-04-18T18:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964625#M375664</link>
      <description>Yes, if I use the data step then the records in the report doesn't have any invalid characters but they're still generated in the report.&lt;BR /&gt;&lt;BR /&gt;I think in this case where step is best option and i may need to manually adjust the variables</description>
      <pubDate>Fri, 18 Apr 2025 19:08:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964625#M375664</guid>
      <dc:creator>possible</dc:creator>
      <dc:date>2025-04-18T19:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964627#M375666</link>
      <description>&lt;P&gt;Since you are picking observations ("records") based on the presence of invalid characters in ANY of the variables there will be some values printed that are fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you see and example where none of the values appear to have any invalid characters then look at the HEX codes for the values.&amp;nbsp; To make it easier you could remove the valid characters first using KCOMPRESS()&amp;nbsp; and then only print the hexcodes for the characters that are left.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Say this issue is identified in observation 10 you could run this data step to see any non valid characters in that observation only.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  set have (firstobs=10 obs=10);
  length string $200;
  string=kcompress(cats(of _character_),collate(26,126)||'C2A0'x));
  len = lengthn(string);
  string = putc(string,cats('$hex',2*len));
  put string=;
run;
  &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might see things like TAB ('09'x) or LINEFEED ('0A'x) or perhaps some other invisible character.&lt;/P&gt;</description>
      <pubDate>Fri, 18 Apr 2025 19:19:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964627#M375666</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-04-18T19:19:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964794#M375704</link>
      <description>Thank you for helping. I was helping but I got a new request where only effected field must be printed and not entire row. this means if a variable has special characters then only that field with the values should be printed. How to handle this?</description>
      <pubDate>Mon, 21 Apr 2025 20:51:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964794#M375704</guid>
      <dc:creator>possible</dc:creator>
      <dc:date>2025-04-21T20:51:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964796#M375705</link>
      <description>&lt;P&gt;In that case you will want to use the DO loop method to check each member of the array of character variables.&amp;nbsp; Add an OUTPUT statement inside the DO loop to write out an observation per variable with issues.&amp;nbsp; (or just have the data step write the report directly without saving.&amp;nbsp; Which was easier in the days of plain text output.)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You will need to take some care to use variable names that do not actually appear in your dataset.&lt;/P&gt;
&lt;P&gt;One to store the NAME of the variable with issues and another to store the VALUE of the variable.&lt;/P&gt;
&lt;P&gt;You might also want to keep any KEY variables that you dataset has, or perhaps just keep the observations number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data report;
  length __obs__ 8 __name__ $32 __value__ $400 ;
  set have;
  __obs__+1;
  array _char_ _character_;
  do _n_=1 to dim(_char_) ;
    if kverify(_char_[_n_],collate(32,126)||'C2A0'x) then do;
      __name__ = vname(_char_[_n_]);
      __value__ = _char_[_n_];
      output;
    end;
  end;
  keep __obs__ __name__ __value__;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 Apr 2025 22:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964796#M375705</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-04-21T22:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964833#M375718</link>
      <description>Thank you. This is working. For some of the values, I see that "?" is been printed into output which is valid ASCII code and this record shouldn't be in the listing. Any suggestion?</description>
      <pubDate>Tue, 22 Apr 2025 13:20:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964833#M375718</guid>
      <dc:creator>possible</dc:creator>
      <dc:date>2025-04-22T13:20:34Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964834#M375719</link>
      <description>&lt;P&gt;Look at the actual hex codes of the characters in the field.&amp;nbsp; Most likely there is a TAB or other invisible character in addition to the ?.&amp;nbsp; Or perhaps the printer is just displaying ? instead of some character it does not understand.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You might want to include that in the report.&amp;nbsp; For example you might include the hex code of the first invalid character it finds.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data report;
  length __obs__ __loc__ 8 __hex__ $8 __name__ $32 __value__ $400 ;
  set have;
  __obs__+1;
  array _char_ _character_;
  do _n_=1 to dim(_char_) ;
    __loc__ =  kverify(_char_[_n_],collate(32,126)||'C2A0'x) ;
    if __loc__ then do;
      __hex__ =ksubstr(_char_[_n_],__loc__,1);
      __hex__ =putc(__hex__,cats('$hex',2*length(__hex__)));
      __name__ = vname(_char_[_n_]);
      __value__ = _char_[_n_];
      output;
    end;
  end;
  keep __obs__ __loc__ __hex__ __name__ __value__;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Apr 2025 13:54:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964834#M375719</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2025-04-22T13:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: SAS code to create a report where the Special Character are been entered in all datasets</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964941#M375739</link>
      <description>Thank you for the assists Tom. It worked.</description>
      <pubDate>Wed, 23 Apr 2025 12:51:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-code-to-create-a-report-where-the-Special-Character-are-been/m-p/964941#M375739</guid>
      <dc:creator>possible</dc:creator>
      <dc:date>2025-04-23T12:51:20Z</dc:date>
    </item>
  </channel>
</rss>

