<?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: Keep observations where variable does not contain punctuation/special characters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Keep-observations-where-variable-does-not-contain-punctuation/m-p/821604#M324380</link>
    <description>&lt;P&gt;I don't think the post helps with my two questions. I would like to do a proc freq to see how many accounts I would have to exclude (if a name has any punctuation/special character, it will have to be excluded), and I don't know what could be used for my second question in the where statement I wrote to only keep accounts that do not have any special characters/punctuation in the name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If anyone has the exact code I could use to answer my two questions, that would be greatly appreciated!&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jul 2022 14:18:47 GMT</pubDate>
    <dc:creator>Justin9</dc:creator>
    <dc:date>2022-07-05T14:18:47Z</dc:date>
    <item>
      <title>Keep observations where variable does not contain punctuation/special characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-observations-where-variable-does-not-contain-punctuation/m-p/821590#M324374</link>
      <description>&lt;P&gt;I have a dataset which has 100,000 accounts. There are three variables: account_number, type and name. I have two questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question 1&lt;/P&gt;
&lt;P&gt;-In the 'name' variable, I have seen some observations that have punctuation/special characters e.g. "Mr James Thomas (ES1)". Is there a &lt;U&gt;proc freq&lt;/U&gt; that I could use to &lt;U&gt;find how many observations&lt;/U&gt; have &lt;U&gt;punctuation/special characters&lt;/U&gt; e.g. brackets, commas etc., as I would like to know how many accounts that I would exclude from my original dataset in order to create the dataset that I want?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Question 2&lt;/P&gt;
&lt;P&gt;-In my final dataset, I would like to &lt;U&gt;exclude accounts&amp;nbsp;in the 'name' variable where punctuation/special characters exist in the name e.g. brackets are part of the observation&amp;nbsp;&lt;/U&gt;e.g.&amp;nbsp;e.g. "Mr James Thomas (ES1)", as I just want to keep observations that only have letters/names e.g. "Mr Brian Wilson". What would be the correct code in my where statement to set accounts where the 'name' variable does not contain any punctuation/special characters?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data final_dataset;
   set test;
   where type=1 and name not contains [code to ensure observations in 'name' variable do not have punctuation or special characters] ; /*What code to keep names that do not have any punctuation/special characters e.g. Mr James Wilson (ES1) should be excluded, as it has brackets?*/
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 13:22:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-observations-where-variable-does-not-contain-punctuation/m-p/821590#M324374</guid>
      <dc:creator>Justin9</dc:creator>
      <dc:date>2022-07-05T13:22:39Z</dc:date>
    </item>
    <item>
      <title>Re: Keep observations where variable does not contain punctuation/special characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-observations-where-variable-does-not-contain-punctuation/m-p/821600#M324377</link>
      <description>Have a look at this post &lt;A href="https://communities.sas.com/t5/SAS-Programming/How-to-identify-special-characters-in-a-character-string/m-p/213296" target="_blank"&gt;https://communities.sas.com/t5/SAS-Programming/How-to-identify-special-characters-in-a-character-string/m-p/213296&lt;/A&gt;. Does that help?</description>
      <pubDate>Tue, 05 Jul 2022 13:58:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-observations-where-variable-does-not-contain-punctuation/m-p/821600#M324377</guid>
      <dc:creator>JosvanderVelden</dc:creator>
      <dc:date>2022-07-05T13:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: Keep observations where variable does not contain punctuation/special characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-observations-where-variable-does-not-contain-punctuation/m-p/821604#M324380</link>
      <description>&lt;P&gt;I don't think the post helps with my two questions. I would like to do a proc freq to see how many accounts I would have to exclude (if a name has any punctuation/special character, it will have to be excluded), and I don't know what could be used for my second question in the where statement I wrote to only keep accounts that do not have any special characters/punctuation in the name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If anyone has the exact code I could use to answer my two questions, that would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 14:18:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-observations-where-variable-does-not-contain-punctuation/m-p/821604#M324380</guid>
      <dc:creator>Justin9</dc:creator>
      <dc:date>2022-07-05T14:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Keep observations where variable does not contain punctuation/special characters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Keep-observations-where-variable-does-not-contain-punctuation/m-p/821607#M324383</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/321018"&gt;@Justin9&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I don't think the post helps with my two questions. I would like to do a proc freq to see how many accounts I would have to exclude (if a name has any punctuation/special character, it will have to be excluded)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This method identifies the observations you want and the ones you don't want; you can create a flag variable with values of 0 or 1. Then run PROC FREQ on the flag variable.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2022 14:24:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Keep-observations-where-variable-does-not-contain-punctuation/m-p/821607#M324383</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-05T14:24:05Z</dc:date>
    </item>
  </channel>
</rss>

