<?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: I need to keep only valid data - All uppercase letters in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949217#M371342</link>
    <description>&lt;P&gt;To test if a string has invalid characters use the VERIFY() function.&amp;nbsp; It will return the position of the first character not in the list of valid characters.&amp;nbsp; If there are no invalid characters it returns zero.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  if verify(strip(cod_sale),'ABCDEFGHIJKLMNOPQRSTUVWXYZ') then delete;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also it will not going to work to use the max operator, &amp;lt;&amp;gt;,&amp;nbsp; when comparing strings.&amp;nbsp; That only works with numeric values.&lt;/P&gt;
&lt;PRE&gt;1    data test;
2      set sashelp.class(obs=2);
3      if name &amp;lt;&amp;gt; ' ' then put name= 'larger than space.';
NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "MAX".
4      else put name= 'same as space.';
5    run;

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      3:11
NOTE: Invalid numeric data, 'Alfred' , at line 3 column 11.
Name=Alfred same as space.
Name=Alfred Sex=M Age=14 Height=69 Weight=112.5 _ERROR_=1 _N_=1
NOTE: Invalid numeric data, 'Alice' , at line 3 column 11.
Name=Alice same as space.
Name=Alice Sex=F Age=13 Height=56.5 Weight=84 _ERROR_=1 _N_=2
NOTE: There were 2 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.TEST has 2 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 28 Oct 2024 11:44:03 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2024-10-28T11:44:03Z</dc:date>
    <item>
      <title>I need to keep only valid data - All uppercase letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949201#M371336</link>
      <description>&lt;P&gt;I have a column named Cod_Sale, which should only be either null (there's no sale) or the code all in UpperCase Letters.&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;P&gt;Cod_Sale IN (PRIM, SEC, THIRD, UP) ... etc, each month we can receive new Codes&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have to remove all data that don't have a sale cod, meaning Cod_Sale &amp;lt;&amp;gt; "".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, when I do this it also selects some value that have Cod_Sale = "". I tried the functions compress, spit and trim to see if it had any blanks, but it still doesn't work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Even if I select compress(Cod_Sale) &amp;lt;&amp;gt; "" or split(Cod_Sale) &amp;lt;&amp;gt; "" or trim(Cod_Sale) &amp;lt;&amp;gt; "" it still selects data with Cod_Sale in blank!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please help me?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 10:20:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949201#M371336</guid>
      <dc:creator>InêsMaximiano</dc:creator>
      <dc:date>2024-10-28T10:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: I need to keep only valid data - All uppercase letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949202#M371337</link>
      <description>&lt;P&gt;One possibility for what you observe is that there are other non-print characters in your data - a tab for example.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You could try below syntax for such a situation:&lt;/P&gt;
&lt;PRE&gt;if missing(compress(Cod_Sale,,'s')) then delete;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Oct 2024 10:32:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949202#M371337</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-10-28T10:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: I need to keep only valid data - All uppercase letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949205#M371338</link>
      <description>Thank you so much for your fast answer, but that still didn't work.</description>
      <pubDate>Mon, 28 Oct 2024 10:38:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949205#M371338</guid>
      <dc:creator>InêsMaximiano</dc:creator>
      <dc:date>2024-10-28T10:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: I need to keep only valid data - All uppercase letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949211#M371339</link>
      <description>&lt;P&gt;For a row with a value that you believe should get deleted but doesn't issue below command:&lt;/P&gt;
&lt;PRE&gt;put &amp;lt;variable&amp;gt; hex.;&lt;/PRE&gt;
&lt;P&gt;Then share with us what gets written to the log.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 10:55:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949211#M371339</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2024-10-28T10:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: I need to keep only valid data - All uppercase letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949215#M371341</link>
      <description>Show the context in which &amp;lt;&amp;gt; is being used.  SQL interprets it differently than a DATA step.</description>
      <pubDate>Mon, 28 Oct 2024 11:28:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949215#M371341</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2024-10-28T11:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: I need to keep only valid data - All uppercase letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949217#M371342</link>
      <description>&lt;P&gt;To test if a string has invalid characters use the VERIFY() function.&amp;nbsp; It will return the position of the first character not in the list of valid characters.&amp;nbsp; If there are no invalid characters it returns zero.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  set have;
  if verify(strip(cod_sale),'ABCDEFGHIJKLMNOPQRSTUVWXYZ') then delete;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Also it will not going to work to use the max operator, &amp;lt;&amp;gt;,&amp;nbsp; when comparing strings.&amp;nbsp; That only works with numeric values.&lt;/P&gt;
&lt;PRE&gt;1    data test;
2      set sashelp.class(obs=2);
3      if name &amp;lt;&amp;gt; ' ' then put name= 'larger than space.';
NOTE: The "&amp;lt;&amp;gt;" operator is interpreted as "MAX".
4      else put name= 'same as space.';
5    run;

NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).
      3:11
NOTE: Invalid numeric data, 'Alfred' , at line 3 column 11.
Name=Alfred same as space.
Name=Alfred Sex=M Age=14 Height=69 Weight=112.5 _ERROR_=1 _N_=1
NOTE: Invalid numeric data, 'Alice' , at line 3 column 11.
Name=Alice same as space.
Name=Alice Sex=F Age=13 Height=56.5 Weight=84 _ERROR_=1 _N_=2
NOTE: There were 2 observations read from the data set SASHELP.CLASS.
NOTE: The data set WORK.TEST has 2 observations and 5 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.01 seconds
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 11:44:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949217#M371342</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-10-28T11:44:03Z</dc:date>
    </item>
    <item>
      <title>Re: I need to keep only valid data - All uppercase letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949218#M371343</link>
      <description>&lt;P&gt;Thank you so much for all your helps!&lt;/P&gt;
&lt;P&gt;The function&amp;nbsp;compress(&lt;SPAN&gt;Cod_Sale&lt;/SPAN&gt;, , 'kw') worked to remove all blanks and non-print characters!!&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 11:40:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949218#M371343</guid>
      <dc:creator>InêsMaximiano</dc:creator>
      <dc:date>2024-10-28T11:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: I need to keep only valid data - All uppercase letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949225#M371348</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/417025"&gt;@InêsMaximiano&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you so much for all your helps!&lt;/P&gt;
&lt;P&gt;The function&amp;nbsp;compress(&lt;SPAN&gt;Cod_Sale&lt;/SPAN&gt;, , 'kw') worked to remove all blanks and non-print characters!!&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I thought the task was to detect OBSERVATIONS that invalid values in the COD_SALE variable.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Will just removing the invalid characters result in converting the invalid values of COD_SALE into valid values?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Oct 2024 13:24:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949225#M371348</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-10-28T13:24:32Z</dc:date>
    </item>
    <item>
      <title>Re: I need to keep only valid data - All uppercase letters</title>
      <link>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949388#M371392</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/417025"&gt;@InêsMaximiano&lt;/a&gt;&lt;A href="https://surahyaseen-pdf.com/" target="_self"&gt;surahyaseenpdf&amp;nbsp;&lt;/A&gt;wrote:&lt;BR /&gt;&lt;P&gt;I have a column named Cod_Sale, which should only be either null (there's no sale) or the code all in UpperCase Letters.&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;Cod_Sale IN (PRIM, SEC, THIRD, UP) ... etc, each month we can receive new Codes&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have to remove all data that don't have a sale cod, meaning Cod_Sale &amp;lt;&amp;gt; "".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, when I do this it also selects some value that have Cod_Sale = "". I tried the functions compress, spit and trim to see if it had any blanks, but it still doesn't work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even if I select compress(Cod_Sale) &amp;lt;&amp;gt; "" or split(Cod_Sale) &amp;lt;&amp;gt; "" or trim(Cod_Sale) &amp;lt;&amp;gt; "" it still selects data with Cod_Sale in blank!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please help me?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;To filter out invalid entries and keep only uppercase &lt;CODE&gt;Cod_Sale&lt;/CODE&gt; values, try using the &lt;CODE&gt;UPCASE&lt;/CODE&gt; function to ensure the code is uppercase and not blank.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Oct 2024 17:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/I-need-to-keep-only-valid-data-All-uppercase-letters/m-p/949388#M371392</guid>
      <dc:creator>alexben</dc:creator>
      <dc:date>2024-10-29T17:37:52Z</dc:date>
    </item>
  </channel>
</rss>

