<?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: Extracting a certain text between comma and period in a Character variable. in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889762#M39546</link>
    <description>&lt;P&gt;The length for listAuthors was too short for your first sample. If you increase the length then the code as posted works for both rows of your sample data.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1692313990094.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86796iF6DD8C1848378358/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1692313990094.png" alt="Patrick_0-1692313990094.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's going to work for all your data depends on the assumption that the text after the Authors doesn't contain some "embedded" period.&lt;/P&gt;</description>
    <pubDate>Thu, 17 Aug 2023 23:14:39 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2023-08-17T23:14:39Z</dc:date>
    <item>
      <title>Extracting a certain text between comma and period in a Character variable.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889755#M39543</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a character variable named "Title and Authors" that contains a long text and I want to extract a certain text which is last Author name that lies between comma and period as shown in &lt;FONT color="#FF0000"&gt;RED&lt;/FONT&gt; the example below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Title and Authors&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;1- Minervina AA, Pogorelyy MV, Kirk AM, Crawford JC, Allen EK, Chou CH, Mettelman RC, Allison KJ, Lin CY, Brice DC, Zhu X, Vegesana K, Wu G, Trivedi S, Kottapalli P, Darnell D, McNeely S, Olsen SR, Schultz-Cherry S, McGargill MA, Wolf J, &lt;FONT color="#FF0000"&gt;Thomas PG&lt;/FONT&gt;. SARS-CoV-2 antigen exposure history shapes phenotypes and specificity of memory CD8(+) T cells.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2-&amp;nbsp;Bauler M, Roberts JK, Wu CC, Fan B, Ferrara F, Yip BH, Diao S, Kim YI, Moore J, Zhou S, Wielgosz MM, Ryu B, &lt;FONT color="#FF0000"&gt;Throm RE&lt;/FONT&gt;. Production of lentiviral vectors using suspension cells grown in serum-free media.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 22:30:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889755#M39543</guid>
      <dc:creator>Rahim_221</dc:creator>
      <dc:date>2023-08-17T22:30:45Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a certain text between comma and period in a Character variable.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889757#M39544</link>
      <description>&lt;P&gt;Below should work if the desired substring is always right after the 2nd period in your source string.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data null;
  string='2- Bauler M, Roberts JK, Wu CC, Fan B, Ferrara F, Yip BH, Diao S, Kim YI, Moore J, Zhou S, Wielgosz MM, Ryu B, Throm RE. Production of lentiviral vectors using suspension cells grown in serum-free media.';
  length lastAuthor $40 listAuthors $200;
  listAuthors=scan(string,-2,'.');
  lastAuthor=scan(listAuthors,-1,',');
  put lastAuthor=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 17 Aug 2023 22:52:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889757#M39544</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-08-17T22:52:14Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a certain text between comma and period in a Character variable.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889759#M39545</link>
      <description>&lt;P&gt;Thank you. The code you provided worked on only the second observation, however I have about 1900 rows/observations that I want to extract the last author's name from. Is there a way to make this code work on all observations?&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 22:58:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889759#M39545</guid>
      <dc:creator>Rahim_221</dc:creator>
      <dc:date>2023-08-17T22:58:29Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a certain text between comma and period in a Character variable.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889762#M39546</link>
      <description>&lt;P&gt;The length for listAuthors was too short for your first sample. If you increase the length then the code as posted works for both rows of your sample data.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Patrick_0-1692313990094.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86796iF6DD8C1848378358/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Patrick_0-1692313990094.png" alt="Patrick_0-1692313990094.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If it's going to work for all your data depends on the assumption that the text after the Authors doesn't contain some "embedded" period.&lt;/P&gt;</description>
      <pubDate>Thu, 17 Aug 2023 23:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889762#M39546</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2023-08-17T23:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a certain text between comma and period in a Character variable.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889767#M39549</link>
      <description>&lt;P&gt;Since the style seems to be to not have periods for author initials it looks pretty simple to find the last author.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile cards truncover;
  input line $500.;
cards4;
1- Minervina AA, Pogorelyy MV, Kirk AM, Crawford JC, Allen EK, Chou CH, Mettelman RC, Allison KJ, Lin CY, Brice DC, Zhu X, Vegesana K, Wu G, Trivedi S, Kottapalli P, Darnell D, McNeely S, Olsen SR, Schultz-Cherry S, McGargill MA, Wolf J, Thomas PG. SARS-CoV-2 antigen exposure history shapes phenotypes and specificity of memory CD8(+) T cells.
2- Bauler M, Roberts JK, Wu CC, Fan B, Ferrara F, Yip BH, Diao S, Kim YI, Moore J, Zhou S, Wielgosz MM, Ryu B, Throm RE. Production of lentiviral vectors using suspension cells grown in serum-free media.
;;;;

data want;
  length author $80;
  set have;
  author=left(scan(scan(line,1,'.'),-1,','));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1692314662179.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/86797i2E6C4905FBCF2158/image-size/large?v=v2&amp;amp;px=999" role="button" title="Tom_0-1692314662179.png" alt="Tom_0-1692314662179.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 18 Aug 2023 00:14:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889767#M39549</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-08-18T00:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting a certain text between comma and period in a Character variable.</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889770#M39550</link>
      <description>Thank you so much. It worked.</description>
      <pubDate>Thu, 17 Aug 2023 23:28:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Extracting-a-certain-text-between-comma-and-period-in-a/m-p/889770#M39550</guid>
      <dc:creator>Rahim_221</dc:creator>
      <dc:date>2023-08-17T23:28:22Z</dc:date>
    </item>
  </channel>
</rss>

