<?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 Splitting a character variable in Viya in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Splitting-a-character-variable-in-Viya/m-p/948699#M18421</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to split a character variable in SAS Viya 4 containing last names. In many cases the variable contains the last name of both partners seperated by a '-'. However, we only want the first last name. The variable looks something like this: 'xxxxxx - xxxxx'. I have tried the functions substring and getword in Viya 4, but they do not seem to do the trick. This is because many last names consist out of multiple words and both functions are not well suited for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does someone have any idea how to tackle this in Viya?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rik&lt;/P&gt;</description>
    <pubDate>Wed, 23 Oct 2024 08:59:30 GMT</pubDate>
    <dc:creator>Rik96</dc:creator>
    <dc:date>2024-10-23T08:59:30Z</dc:date>
    <item>
      <title>Splitting a character variable in Viya</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Splitting-a-character-variable-in-Viya/m-p/948699#M18421</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to split a character variable in SAS Viya 4 containing last names. In many cases the variable contains the last name of both partners seperated by a '-'. However, we only want the first last name. The variable looks something like this: 'xxxxxx - xxxxx'. I have tried the functions substring and getword in Viya 4, but they do not seem to do the trick. This is because many last names consist out of multiple words and both functions are not well suited for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does someone have any idea how to tackle this in Viya?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rik&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 08:59:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Splitting-a-character-variable-in-Viya/m-p/948699#M18421</guid>
      <dc:creator>Rik96</dc:creator>
      <dc:date>2024-10-23T08:59:30Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a character variable in Viya</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Splitting-a-character-variable-in-Viya/m-p/948700#M18422</link>
      <description>&lt;P&gt;SCAN function works for this kind of scenarios:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/v_056/lefunctionsref/p0jshdjy2z9zdzn1h7k90u99lyq6.htm" target="_blank"&gt;SAS Help Center: SCAN Function&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 09:18:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Splitting-a-character-variable-in-Viya/m-p/948700#M18422</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2024-10-23T09:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a character variable in Viya</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Splitting-a-character-variable-in-Viya/m-p/948703#M18423</link>
      <description>&lt;P&gt;I see I mentioned the wrong environment. I mean Visual Analytics. The scan function is not part of this.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 09:38:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Splitting-a-character-variable-in-Viya/m-p/948703#M18423</guid>
      <dc:creator>Rik96</dc:creator>
      <dc:date>2024-10-23T09:38:37Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a character variable in Viya</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Splitting-a-character-variable-in-Viya/m-p/948706#M18424</link>
      <description>&lt;P&gt;In Visual Analytics you can use the FindChar / FindString functions instead, in contrast to the FindWord function you can specify the separator(s) this way. For your example this could work:&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;IF&lt;/SPAN&gt;&lt;SPAN&gt; (&lt;/SPAN&gt;&lt;SPAN&gt;FindChar&lt;/SPAN&gt;&lt;SPAN&gt;(LastName, &lt;/SPAN&gt;&lt;SPAN&gt;'-'&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt;&lt;/SPAN&gt; &lt;SPAN&gt;0&lt;/SPAN&gt;&lt;SPAN&gt;) &lt;/SPAN&gt;&lt;SPAN&gt;return&lt;/SPAN&gt; &lt;SPAN&gt;Substring&lt;/SPAN&gt;&lt;SPAN&gt;(LastName, &lt;/SPAN&gt;&lt;SPAN&gt;1&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;FindChar&lt;/SPAN&gt;&lt;SPAN&gt;(LastName, &lt;/SPAN&gt;&lt;SPAN&gt;'-'&lt;/SPAN&gt;&lt;SPAN&gt;))&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;ELSE&lt;/SPAN&gt;&lt;SPAN&gt; LastName&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 23 Oct 2024 10:00:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Splitting-a-character-variable-in-Viya/m-p/948706#M18424</guid>
      <dc:creator>pathew</dc:creator>
      <dc:date>2024-10-23T10:00:47Z</dc:date>
    </item>
    <item>
      <title>Re: Splitting a character variable in Viya</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Splitting-a-character-variable-in-Viya/m-p/948714#M18425</link>
      <description>&lt;P&gt;Thanks! This worked&lt;/P&gt;</description>
      <pubDate>Wed, 23 Oct 2024 10:53:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Splitting-a-character-variable-in-Viya/m-p/948714#M18425</guid>
      <dc:creator>Rik96</dc:creator>
      <dc:date>2024-10-23T10:53:51Z</dc:date>
    </item>
  </channel>
</rss>

