<?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: Filter register with only one character in a character variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Filter-register-with-only-one-character-in-a-character-variable/m-p/837994#M331356</link>
    <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is some example of the data I have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input string $9. ;
cards;
1103355
15126465
17007959
17008064
505495945
506795233
510150497
7133364
8418202
000000000
A36002541
000000000
a94150422
0
00
000
0000
00000
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your solution is a good solution.&lt;BR /&gt;&lt;BR /&gt;This is a character variable.&amp;nbsp;So I converted it into a numeric variable and all the "kind of" zeros were converted into a single zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data CONT;
    set CONT;

    NP_N = input(NP, best12.) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 12 Oct 2022 09:21:08 GMT</pubDate>
    <dc:creator>ramgouveia</dc:creator>
    <dc:date>2022-10-12T09:21:08Z</dc:date>
    <item>
      <title>Filter register with only one character in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filter-register-with-only-one-character-in-a-character-variable/m-p/837801#M331279</link>
      <description>&lt;DIV class="x1e56ztr" data-block="true" data-editor="b469m" data-offset-key="4af95-0-0"&gt;
&lt;DIV class="_1mf _1mj" data-offset-key="4af95-0-0"&gt;&lt;SPAN data-offset-key="4af95-0-0"&gt;I want to &lt;/SPAN&gt;&lt;SPAN&gt;identify&lt;/SPAN&gt;&lt;SPAN data-offset-key="4af95-2-0"&gt; the registers in a SAS dataset that in a character variable contains only zeros.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="x1e56ztr" data-block="true" data-editor="b469m" data-offset-key="5bsm2-0-0"&gt;
&lt;DIV class="_1mf _1mj" data-offset-key="5bsm2-0-0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="_1mf _1mj" data-offset-key="5bsm2-0-0"&gt;&lt;SPAN data-offset-key="5bsm2-0-0"&gt;How can I do this?&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Tue, 11 Oct 2022 08:38:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filter-register-with-only-one-character-in-a-character-variable/m-p/837801#M331279</guid>
      <dc:creator>ramgouveia</dc:creator>
      <dc:date>2022-10-11T08:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: Filter register with only one character in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filter-register-with-only-one-character-in-a-character-variable/m-p/837815#M331288</link>
      <description>&lt;P&gt;all zeros can be identified as&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;input(yourvariablename,?? best32.)=0&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Oct 2022 10:55:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filter-register-with-only-one-character-in-a-character-variable/m-p/837815#M331288</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-10-11T10:55:04Z</dc:date>
    </item>
    <item>
      <title>Re: Filter register with only one character in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filter-register-with-only-one-character-in-a-character-variable/m-p/837965#M331341</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/369095"&gt;@ramgouveia&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;DIV class="x1e56ztr" data-block="true" data-editor="b469m" data-offset-key="4af95-0-0"&gt;
&lt;DIV class="_1mf _1mj" data-offset-key="4af95-0-0"&gt;&lt;SPAN data-offset-key="4af95-0-0"&gt;I want to &lt;/SPAN&gt;&lt;SPAN&gt;identify&lt;/SPAN&gt;&lt;SPAN data-offset-key="4af95-2-0"&gt; the registers in a SAS dataset that in a character variable contains only zeros.&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;DIV class="x1e56ztr" data-block="true" data-editor="b469m" data-offset-key="5bsm2-0-0"&gt;
&lt;DIV class="_1mf _1mj" data-offset-key="5bsm2-0-0"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="_1mf _1mj" data-offset-key="5bsm2-0-0"&gt;&lt;SPAN data-offset-key="5bsm2-0-0"&gt;How can I do this?&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;So the variable is filled with zeros?&amp;nbsp; So if the variable is defined as length $10 it has 10 zeros?&lt;/P&gt;
&lt;P&gt;Or do you also want the strings that have 9 zeros and those with 8 zeros?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input string $5. ;
cards;
1
0
00
000
0000
00000
.
;

data want;
 set test;
 want=  verify(string||'x','0')&amp;gt;length(string) ;
run;

proc print;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result&lt;/P&gt;
&lt;PRE&gt;Obs    string    want

 1     1           0
 2     0           1
 3     00          1
 4     000         1
 5     0000        1
 6     00000       1
 7                 0

&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2022 00:08:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filter-register-with-only-one-character-in-a-character-variable/m-p/837965#M331341</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-10-12T00:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: Filter register with only one character in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filter-register-with-only-one-character-in-a-character-variable/m-p/837994#M331356</link>
      <description>&lt;P&gt;Thank you&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is some example of the data I have:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
  input string $9. ;
cards;
1103355
15126465
17007959
17008064
505495945
506795233
510150497
7133364
8418202
000000000
A36002541
000000000
a94150422
0
00
000
0000
00000
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Your solution is a good solution.&lt;BR /&gt;&lt;BR /&gt;This is a character variable.&amp;nbsp;So I converted it into a numeric variable and all the "kind of" zeros were converted into a single zero.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I used the following code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data CONT;
    set CONT;

    NP_N = input(NP, best12.) ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Oct 2022 09:21:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filter-register-with-only-one-character-in-a-character-variable/m-p/837994#M331356</guid>
      <dc:creator>ramgouveia</dc:creator>
      <dc:date>2022-10-12T09:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: Filter register with only one character in a character variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Filter-register-with-only-one-character-in-a-character-variable/m-p/837995#M331357</link>
      <description>Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&lt;BR /&gt;&lt;BR /&gt;I will use it.</description>
      <pubDate>Wed, 12 Oct 2022 09:22:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Filter-register-with-only-one-character-in-a-character-variable/m-p/837995#M331357</guid>
      <dc:creator>ramgouveia</dc:creator>
      <dc:date>2022-10-12T09:22:21Z</dc:date>
    </item>
  </channel>
</rss>

