<?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: How can I delete all single character in a column? in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-can-I-delete-all-single-character-in-a-column/m-p/912351#M40837</link>
    <description>&lt;P&gt;The version of Enterprise Guide should not matter since you will have to use actual SAS code for this.&amp;nbsp; And it should not matter what version of SAS you are using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could probably construct a regular expression that would do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But here is a method using regular SAS functions, COUNTW(), SCAN() and CATX().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  newvar=oldvar;
  newvar=' ';
  do i=1 to countw(oldvar,' ');
    if length(scan(oldvar,i,' '))&amp;gt;1 then newvar=catx(' ',newvar,scan(oldvar,i,' '));
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 20 Jan 2024 17:42:00 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-01-20T17:42:00Z</dc:date>
    <item>
      <title>How can I delete all single character in a column?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-I-delete-all-single-character-in-a-column/m-p/912350#M40836</link>
      <description>&lt;P&gt;Hello !&lt;/P&gt;&lt;P&gt;I would like to delete all single character (between two spaces)in a column.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example : test h text2 z&lt;/P&gt;&lt;P&gt;In this example I would like to delete 'h' and 'z'.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you, if you can help me.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use SAS EG 8.2.4.&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 17:21:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-I-delete-all-single-character-in-a-column/m-p/912350#M40836</guid>
      <dc:creator>Neptun83</dc:creator>
      <dc:date>2024-01-20T17:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: How can I delete all single character in a column?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-I-delete-all-single-character-in-a-column/m-p/912351#M40837</link>
      <description>&lt;P&gt;The version of Enterprise Guide should not matter since you will have to use actual SAS code for this.&amp;nbsp; And it should not matter what version of SAS you are using.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could probably construct a regular expression that would do it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But here is a method using regular SAS functions, COUNTW(), SCAN() and CATX().&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  newvar=oldvar;
  newvar=' ';
  do i=1 to countw(oldvar,' ');
    if length(scan(oldvar,i,' '))&amp;gt;1 then newvar=catx(' ',newvar,scan(oldvar,i,' '));
  end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 17:42:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-I-delete-all-single-character-in-a-column/m-p/912351#M40837</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-01-20T17:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can I delete all single character in a column?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-I-delete-all-single-character-in-a-column/m-p/912368#M40838</link>
      <description>&lt;P&gt;Here an approach using a regular expression&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines truncover;
  input str $40.;
  datalines;
test h text2 z
a b test h text2 z
test h text2
;

data want; 
  set have;
  length str2 $40;
  str2=prxchange('s/\b\w\b\s?//oi',-1,str);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 23:57:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-I-delete-all-single-character-in-a-column/m-p/912368#M40838</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-01-20T23:57:21Z</dc:date>
    </item>
    <item>
      <title>Re: How can I delete all single character in a column?</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-can-I-delete-all-single-character-in-a-column/m-p/912570#M40856</link>
      <description>&lt;P&gt;Thank you for the replies guys! Both of them were very useful for me!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 22:07:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-can-I-delete-all-single-character-in-a-column/m-p/912570#M40856</guid>
      <dc:creator>Neptun83</dc:creator>
      <dc:date>2024-01-22T22:07:33Z</dc:date>
    </item>
  </channel>
</rss>

