<?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 Selecting specific values from character data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Selecting-specific-values-from-character-data/m-p/720129#M223050</link>
    <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the following SAS dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt; EXAMPLE1;&lt;/P&gt;&lt;P&gt;INPUT Names $ &lt;STRONG&gt;30&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;DATALINES;&lt;/P&gt;&lt;P&gt;**RMPQ&lt;/P&gt;&lt;P&gt;Dr. AARON RAY&lt;/P&gt;&lt;P&gt;AARON,RAY MD&lt;/P&gt;&lt;P&gt;RAY,AARON MDS&lt;/P&gt;&lt;P&gt;PMD RAY ARON&lt;/P&gt;&lt;P&gt;AARON MD RAY&lt;/P&gt;&lt;P&gt;SUNSET MED CTR&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;I want to get another variable or dataset in which there are person names and NO medical facility or arbitrary alphanumeric characters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used the following to code to create a new subset&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt; EXAMPLE1;&lt;/P&gt;&lt;P&gt;INPUT Names $ &lt;STRONG&gt;30&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;DATALINES;&lt;/P&gt;&lt;P&gt;**RMPQ&lt;/P&gt;&lt;P&gt;Dr. AARON RAY&lt;/P&gt;&lt;P&gt;AARON,RAY MD&lt;/P&gt;&lt;P&gt;RAY,AARON MDS&lt;/P&gt;&lt;P&gt;PMD RAY ARON&lt;/P&gt;&lt;P&gt;AARON MD RAY&lt;/P&gt;&lt;P&gt;AARON RAY&lt;/P&gt;&lt;P&gt;SUNSET MED CTR&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt; EXAMPLE_COPY;&lt;/P&gt;&lt;P&gt;SET EXAMPLE1;&lt;/P&gt;&lt;P&gt;IF (INDEXW(NAMES ,'Dr.') OR INDEXW(NAMES,'MD') OR INDEXW(NAMES ,'MDS') OR INDEXW(NAMES ,'PMD')) GT &lt;STRONG&gt;0&lt;/STRONG&gt; THEN SELECTION = 'YES';&lt;/P&gt;&lt;P&gt;ELSE SELECTION = 'NO';&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt; &lt;STRONG&gt;PRINT&lt;/STRONG&gt; DATA=EXAMPLE_COPY;&lt;/P&gt;&lt;P&gt;TITLE "Listing of Data Set w DOCTOR NAMES";&lt;/P&gt;&lt;P&gt;ID NAMES ;&lt;/P&gt;&lt;P&gt;VAR Selection;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;But this leaves out the person names without MD, MDS etc. It would be preferable if I can select person names out of my variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My desired output&lt;/P&gt;&lt;P&gt;Names&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; Selection&lt;/P&gt;&lt;P&gt;**RMPQ&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;NO&lt;/P&gt;&lt;P&gt;Dr. AARON RAY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YES&lt;/P&gt;&lt;P&gt;AARON,RAY MD&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YES&lt;/P&gt;&lt;P&gt;RAY,AARON MDS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YES&lt;/P&gt;&lt;P&gt;PMD RAY ARON&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YES&lt;/P&gt;&lt;P&gt;AARON MD RAY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YES&lt;/P&gt;&lt;P&gt;AARON RAY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;YES &amp;nbsp;&lt;/P&gt;&lt;P&gt;SUNSET MED CTR&amp;nbsp; &amp;nbsp; &amp;nbsp; NO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OR any other way of getting person names.&lt;/P&gt;&lt;P&gt;Any help will be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Feb 2021 08:16:47 GMT</pubDate>
    <dc:creator>Priyamvada07</dc:creator>
    <dc:date>2021-02-18T08:16:47Z</dc:date>
    <item>
      <title>Selecting specific values from character data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-specific-values-from-character-data/m-p/720129#M223050</link>
      <description>&lt;P&gt;Hello!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the following SAS dataset&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt; EXAMPLE1;&lt;/P&gt;&lt;P&gt;INPUT Names $ &lt;STRONG&gt;30&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;DATALINES;&lt;/P&gt;&lt;P&gt;**RMPQ&lt;/P&gt;&lt;P&gt;Dr. AARON RAY&lt;/P&gt;&lt;P&gt;AARON,RAY MD&lt;/P&gt;&lt;P&gt;RAY,AARON MDS&lt;/P&gt;&lt;P&gt;PMD RAY ARON&lt;/P&gt;&lt;P&gt;AARON MD RAY&lt;/P&gt;&lt;P&gt;SUNSET MED CTR&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;I want to get another variable or dataset in which there are person names and NO medical facility or arbitrary alphanumeric characters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have used the following to code to create a new subset&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt; EXAMPLE1;&lt;/P&gt;&lt;P&gt;INPUT Names $ &lt;STRONG&gt;30&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;DATALINES;&lt;/P&gt;&lt;P&gt;**RMPQ&lt;/P&gt;&lt;P&gt;Dr. AARON RAY&lt;/P&gt;&lt;P&gt;AARON,RAY MD&lt;/P&gt;&lt;P&gt;RAY,AARON MDS&lt;/P&gt;&lt;P&gt;PMD RAY ARON&lt;/P&gt;&lt;P&gt;AARON MD RAY&lt;/P&gt;&lt;P&gt;AARON RAY&lt;/P&gt;&lt;P&gt;SUNSET MED CTR&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt; EXAMPLE_COPY;&lt;/P&gt;&lt;P&gt;SET EXAMPLE1;&lt;/P&gt;&lt;P&gt;IF (INDEXW(NAMES ,'Dr.') OR INDEXW(NAMES,'MD') OR INDEXW(NAMES ,'MDS') OR INDEXW(NAMES ,'PMD')) GT &lt;STRONG&gt;0&lt;/STRONG&gt; THEN SELECTION = 'YES';&lt;/P&gt;&lt;P&gt;ELSE SELECTION = 'NO';&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PROC&lt;/STRONG&gt; &lt;STRONG&gt;PRINT&lt;/STRONG&gt; DATA=EXAMPLE_COPY;&lt;/P&gt;&lt;P&gt;TITLE "Listing of Data Set w DOCTOR NAMES";&lt;/P&gt;&lt;P&gt;ID NAMES ;&lt;/P&gt;&lt;P&gt;VAR Selection;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;But this leaves out the person names without MD, MDS etc. It would be preferable if I can select person names out of my variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My desired output&lt;/P&gt;&lt;P&gt;Names&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; Selection&lt;/P&gt;&lt;P&gt;**RMPQ&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;NO&lt;/P&gt;&lt;P&gt;Dr. AARON RAY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YES&lt;/P&gt;&lt;P&gt;AARON,RAY MD&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YES&lt;/P&gt;&lt;P&gt;RAY,AARON MDS&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YES&lt;/P&gt;&lt;P&gt;PMD RAY ARON&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YES&lt;/P&gt;&lt;P&gt;AARON MD RAY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; YES&lt;/P&gt;&lt;P&gt;AARON RAY&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;YES &amp;nbsp;&lt;/P&gt;&lt;P&gt;SUNSET MED CTR&amp;nbsp; &amp;nbsp; &amp;nbsp; NO&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;OR any other way of getting person names.&lt;/P&gt;&lt;P&gt;Any help will be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 08:16:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-specific-values-from-character-data/m-p/720129#M223050</guid>
      <dc:creator>Priyamvada07</dc:creator>
      <dc:date>2021-02-18T08:16:47Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting specific values from character data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-specific-values-from-character-data/m-p/720132#M223051</link>
      <description>&lt;P&gt;What are "person names"? The answer depends on largely on the area you live in. And there are of course names that are more difficult to be recognized as such, like "X Æ A-12".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;EDIT&lt;/P&gt;
&lt;P&gt;Conclusion: even with a long list of words that clearly identify a name a person (or as not-person) it is very, very unlikely that you don't get some false-positives.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 08:55:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-specific-values-from-character-data/m-p/720132#M223051</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2021-02-18T08:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting specific values from character data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-specific-values-from-character-data/m-p/720137#M223053</link>
      <description>&lt;P&gt;Next code separates the degree from the names.&lt;/P&gt;
&lt;P&gt;Please check next code - is this what you want?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA EXAMPLE1;
  INPUT Names $char30.;
DATALINES;
**RMPQ
Dr. AARON RAY
AARON,RAY MD
RAY,AARON MDS
PMD RAY ARON
AARON MD RAY
AARON RAY
SUNSET MED CTR
;
run;

DATA EXAMPLE_COPY;
  SET EXAMPLE1;
  length degree $8;
  array dr {4} $ ('DR.', 'MD', 'MDS', 'PMD');
  do i=1 to dim(dr);
  	 degree = dr(i); 
     put _N_= names= degree=;
     if indexw(names,dr(i),' .') then do; 
	    names = compbl(tranwrd(names,strip(dr(i)),' '));
		leave;
	 end;	
   end;
   drop i dr1-dr4;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Feb 2021 09:23:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-specific-values-from-character-data/m-p/720137#M223053</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2021-02-18T09:23:51Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting specific values from character data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Selecting-specific-values-from-character-data/m-p/720268#M223114</link>
      <description>&lt;P&gt;Do you have a list of likely medical centers in all the various ways that people are likely to enter the name?&lt;/P&gt;
&lt;P&gt;It may be easier to create a look up for those than to attempt a filter on person names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And why the heck are the ** in the **RMPQ value?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW there is no point that I would trust a search for DR or DOCTOR to identify people. Consider DR JONES Memorial Clinic or such names.&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2021 16:45:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Selecting-specific-values-from-character-data/m-p/720268#M223114</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-18T16:45:07Z</dc:date>
    </item>
  </channel>
</rss>

