<?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: get names  letter  with letters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881686#M348386</link>
    <description>&lt;P&gt;Those names starts with k and middle letter L and end with k&amp;nbsp; whose names retrive&lt;/P&gt;</description>
    <pubDate>Wed, 21 Jun 2023 11:40:52 GMT</pubDate>
    <dc:creator>BrahmanandaRao</dc:creator>
    <dc:date>2023-06-21T11:40:52Z</dc:date>
    <item>
      <title>get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881671#M348374</link>
      <description>&lt;P&gt;Hi Guys,&lt;/P&gt;
&lt;P&gt;suppose i have employees table in the table which names &lt;STRONG&gt;starts with 'K' and middle letter with 'L' and end with 'K' in employees name column&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 10:40:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881671#M348374</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2023-06-21T10:40:00Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881681#M348383</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;suppose i have employees table in the table which names &lt;STRONG&gt;starts with 'K' and middle letter with 'L' and end with 'K' in employees name column&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Okay, I am now in my mind supposing that you have this table. What would you like me to do next? Do you have an actual question?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 11:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881681#M348383</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-21T11:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881682#M348384</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Hi Guys,&lt;/P&gt;
&lt;P&gt;suppose i have employees table in the table which names &lt;STRONG&gt;starts with 'K' and middle letter with 'L' and end with 'K' in employees name column&lt;/STRONG&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;And what is your question?&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 11:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881682#M348384</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-21T11:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881686#M348386</link>
      <description>&lt;P&gt;Those names starts with k and middle letter L and end with k&amp;nbsp; whose names retrive&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 11:40:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881686#M348386</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2023-06-21T11:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881688#M348388</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Those names starts with k and middle letter L and end with k&amp;nbsp; whose names retrive&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes. And?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please turn on that thing between your ears and post a&amp;nbsp;&lt;U&gt;question&lt;/U&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 11:44:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881688#M348388</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-21T11:44:48Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881691#M348389</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Those names starts with k and middle letter L and end with k&amp;nbsp; whose names retrive&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;"Names starts with K" — I think I understand that part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Middle letter L" — I don't know what "middle letter" means in this context&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"End with K" — its not really clear to me what this means in this context either&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"Retrive" — this is not a word, and even if it is a simple spelling error, it makes no sense to me in this context either&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please provide sample data (as working SAS data step code) and desired output. Please provide a complete and&amp;nbsp; clear explanation, and not the one-sentence explanation that you usually provide, trying to type as few words as possible. Please be generous with information and generous with your explanation.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 11:52:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881691#M348389</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-21T11:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881697#M348393</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*scenario -1*/

data employees;
  input employee_name $;
  datalines;
John Kilkenny
Kate lark
Kristen Lockhart
Kevin lukasik
Alex King
;
run;

/*senaria-2*/

data employee;
  input name $;
  datalines;
KALAK
KILIK
KULAKzzz
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;first senario- required output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Kate lark&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Kevin lukasik&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;second&amp;nbsp;senario-required&amp;nbsp;output&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;KALAK
KILIK&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Note:ignore&amp;nbsp;case&amp;nbsp;&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 12:36:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881697#M348393</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2023-06-21T12:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881699#M348395</link>
      <description>&lt;P&gt;In your first scenario, your INPUT statement reads only one variable, but your DATALINES contain two items each, so the second item won't appear in the dataset and can therefore not be retrieved in a later step anyway.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 12:41:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881699#M348395</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2023-06-21T12:41:07Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881702#M348398</link>
      <description>&lt;P&gt;I'm afraid I can't understand what you did or why you did it. You have not EXPLAINED. You say you want middle letter 'L' but this is not explained. What do you mean by "middle letter"???&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition, you have been in this community for years now, and we still have to ask you to show us some example data. This is unacceptable.&amp;nbsp; Please provide example data EVERY SINGLE TIME. Do not make us ask.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 12:45:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881702#M348398</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-21T12:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881705#M348400</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data employee;
  input name $;
  datalines;
KALAK
KIpplIK
KULAK
;
run;



proc sql;
  select name
  from employee
  where name like 'K%L%K';
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Jun 2023 12:53:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881705#M348400</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2023-06-21T12:53:02Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881706#M348401</link>
      <description>&lt;P&gt;I specifically asked for an explanation, not code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 12:55:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881706#M348401</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-06-21T12:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881710#M348404</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data EmployeeData;
  input EmployeeName $50.;
  datalines;
kith Walkerk
Karen Clark
Mark Black
Emily Parkerk
Steve Brooks
Kelly link
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Required output with out use regex how to solve&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;kith Walkerk
Karen Clark&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Kelly link&lt;/CODE&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 13:14:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881710#M348404</guid>
      <dc:creator>BrahmanandaRao</dc:creator>
      <dc:date>2023-06-21T13:14:52Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881731#M348410</link>
      <description>&lt;P&gt;One way to create a data set with the actual values and then select those&lt;/P&gt;
&lt;PRE&gt;data employees;
  infile datalines truncover;
  input employee_name $20.;
  datalines;
John Kilkenny
Kate lark
Kristen Lockhart
Kevin lukasik
Alex King
KALAK
KILIK
KULAKzzz
;
run;

data want;
   set employees;
   
   if upcase(employee_name) =:'K' 
     /*^ upper case compare  ^ "begins with"*/
    and upcase(substr(employee_name,length(employee_name),1))='K'
               /* substr function at length for 1 gets last character*/
      and find(employee_name,'L','i')&amp;gt;0;
          /* find letter L somewhere the 'i' is case insensitive*/
run;&lt;/PRE&gt;
&lt;P&gt;"Middle" can have multiple meanings. I am taking it to mean "somewhere between first and last character" for an L.&lt;/P&gt;
&lt;P&gt;The other bits just look at the first and last character for the K's. NOT the only way.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You really need to make sure that your data steps run and produce the desired result for providing example data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/265860"&gt;@BrahmanandaRao&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*scenario -1*/

data employees;
  input employee_name $;
  datalines;
John Kilkenny
Kate lark
Kristen Lockhart
Kevin lukasik
Alex King
;
run;

/*senaria-2*/

data employee;
  input name $;
  datalines;
KALAK
KILIK
KULAKzzz
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;first senario- required output&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Kate lark&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Kevin lukasik&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;second&amp;nbsp;senario-required&amp;nbsp;output&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;KALAK
KILIK&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Note:ignore&amp;nbsp;case&amp;nbsp;&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jun 2023 15:06:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881731#M348410</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-06-21T15:06:47Z</dc:date>
    </item>
    <item>
      <title>Re: get names  letter  with letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881754#M348422</link>
      <description>&lt;P&gt;Testing if the first or last character is a K is easy enough.&lt;/P&gt;
&lt;P&gt;For example you could use FINDC().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  startK=1=findc(name,'k','i');
  lastK=length(name)=findc(name,'k',-length(name),'i');
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or just =: operator.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  startK=upcase(name)=:'K';
  lastK=upcase(reverse(strip(name)))=:'K';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Testing if there is an L anywhere the middle can be done with FINDC().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  middleL=1&amp;lt;findc(name,'L','i')&amp;lt;length(name);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then just require that all three are true.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  want = startK and lastK and middleL ;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Of course if the first and last have to be K then you don't really care where the L is since it will NOT be the first or the last so it will be in the middle.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  want=upcase(name)=:'K'
     and upcase(reverse(strip(name)))=:'K'
     and findc(name,'L','i')
  ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Jun 2023 17:40:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/get-names-letter-with-letters/m-p/881754#M348422</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-21T17:40:56Z</dc:date>
    </item>
  </channel>
</rss>

