<?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: need to extract the ticket number from the variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462128#M117593</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  data have;
  	
  x="This request is part of UAT Ticket# RITM0157177";
  y="Commit result for UAT RITM0180513";

  run;


data want;
	 set have;

	 upx=strip(upcase(x));
	 upy=strip(upcase(y));

	 indx1=index(upx,"RITM");
	 indy1=index(upy,"RITM");

	 lenx1=length(substr(upx,x1));
	 leny1=length(substr(upy,y1));
	
	 subx=substr(upx,indx1,lenx1);
	 suby=substr(upy,indy1,leny1);

	 keep subx suby;
 run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I can make it little shorter but I want to give idea for this that's why it's little long code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 May 2018 16:52:55 GMT</pubDate>
    <dc:creator>shahparth260</dc:creator>
    <dc:date>2018-05-14T16:52:55Z</dc:date>
    <item>
      <title>need to extract the ticket number from the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462114#M117588</link>
      <description>&lt;P&gt;Can anyome help me with the code to extract a ticket number from&amp;nbsp; variable name ' Request item' , data is as below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;number Request_item&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This request is part of UAT Ticket# RITM0157177&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Commit result for UAT RITM0180513&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Expected results&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;number&amp;nbsp;&amp;nbsp;&amp;nbsp; request_item&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;&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;&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;&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ticket&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; This request is part of UAT Ticket# RITM0157177&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;&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;&amp;nbsp; RITM0157177&lt;/P&gt;&lt;P&gt;2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Commit result for UAT RITM0180513&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;&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RITM0180513&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 16:11:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462114#M117588</guid>
      <dc:creator>radha009</dc:creator>
      <dc:date>2018-05-14T16:11:17Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract the ticket number from the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462123#M117591</link>
      <description>Hi:&lt;BR /&gt;  Is the ticket number ALWAYS in request_item? Is it ALWAYS the last piece of the string? Could there be text AFTER the ticket number? Does the ticket number ALWAYS start with RIT or RITM?&lt;BR /&gt;&lt;BR /&gt;Cynthia</description>
      <pubDate>Mon, 14 May 2018 16:44:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462123#M117591</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2018-05-14T16:44:24Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract the ticket number from the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462128#M117593</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  data have;
  	
  x="This request is part of UAT Ticket# RITM0157177";
  y="Commit result for UAT RITM0180513";

  run;


data want;
	 set have;

	 upx=strip(upcase(x));
	 upy=strip(upcase(y));

	 indx1=index(upx,"RITM");
	 indy1=index(upy,"RITM");

	 lenx1=length(substr(upx,x1));
	 leny1=length(substr(upy,y1));
	
	 subx=substr(upx,indx1,lenx1);
	 suby=substr(upy,indy1,leny1);

	 keep subx suby;
 run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I can make it little shorter but I want to give idea for this that's why it's little long code&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 16:52:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462128#M117593</guid>
      <dc:creator>shahparth260</dc:creator>
      <dc:date>2018-05-14T16:52:55Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract the ticket number from the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462129#M117594</link>
      <description>&lt;P&gt;Though&amp;nbsp;&lt;SPAN&gt;Cynthia is absolutely&amp;nbsp;&amp;nbsp;right with her questions for you but I give you just an idea&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 16:54:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462129#M117594</guid>
      <dc:creator>shahparth260</dc:creator>
      <dc:date>2018-05-14T16:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract the ticket number from the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462131#M117595</link>
      <description>&lt;P&gt;You have to extract the 11 last characters from Request_item column&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#000080" face="Verdana" size="3"&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Verdana" size="3"&gt; want; &lt;/FONT&gt;&lt;FONT color="#0000ff" face="Verdana" size="3"&gt;set&lt;/FONT&gt;&lt;FONT face="Verdana" size="3"&gt; have;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Verdana" size="3"&gt;&amp;nbsp;ticket = substr(Request_item, length(Request_item)-&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Verdana" size="3"&gt;11&lt;/FONT&gt;&lt;/STRONG&gt;&lt;FONT face="Verdana" size="3"&gt;);&lt;/FONT&gt;&lt;FONT color="#0000ff" face="Verdana" size="3"&gt;run&lt;/FONT&gt;&lt;FONT face="Verdana" size="3"&gt;;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;**I assume here the ticket number is always displayed at the end of Request_item***&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 16:59:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462131#M117595</guid>
      <dc:creator>nketata</dc:creator>
      <dc:date>2018-05-14T16:59:21Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract the ticket number from the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462146#M117603</link>
      <description>&lt;P&gt;No it will not be always end. it will any where&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 17:39:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462146#M117603</guid>
      <dc:creator>radha009</dc:creator>
      <dc:date>2018-05-14T17:39:01Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract the ticket number from the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462178#M117615</link>
      <description>The ticket number is always in the request item. The text will be there before or after the ticket number. It always starts with RITM and 11 length.&lt;BR /&gt;</description>
      <pubDate>Mon, 14 May 2018 19:40:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462178#M117615</guid>
      <dc:creator>radha009</dc:creator>
      <dc:date>2018-05-14T19:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: need to extract the ticket number from the variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462183#M117619</link>
      <description>&lt;P&gt;Try&lt;/P&gt;
&lt;PRE&gt;  ticket = substr(x,FIND(x,'RITM'),11);
&lt;/PRE&gt;
&lt;P&gt;where X is the name of YOUR variable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;WARNING: &lt;/STRONG&gt;This really only works reasonably well because RITM is an infrequent letter combination in English and the code is supposedly always in upper case. If the code letters at the start were more common such as AT even the upper case might be insufficient to find the ticket if billed to or for AT&amp;amp;T or any other organization with AT in their name or a person that uses those initials frequently. I am sure there are other cases to consider as well.&lt;/P&gt;</description>
      <pubDate>Mon, 14 May 2018 22:13:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/need-to-extract-the-ticket-number-from-the-variable/m-p/462183#M117619</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-05-14T22:13:22Z</dc:date>
    </item>
  </channel>
</rss>

