<?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 remove empty values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-remove-empty-values/m-p/900918#M356045</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please clarify:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) If you have an observation with data like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;a;b;c;.;d;e&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want the result to have 2 semicolons (";") next to each other, with or without a space, like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;a;b;c;;d;e&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or do you want to remove the semicolon too, like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;a;b;c;d;e&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) If the whole observation looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;.;.;.;.;.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then do you want to output that observation, if yes, then what should the result look like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If my questions are not clear, then please&amp;nbsp;&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_blank" rel="noopener"&gt;provide some example data in the form of a data step&lt;/A&gt;, showing input data in one data step and required output in another data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2023 14:43:41 GMT</pubDate>
    <dc:creator>Amir</dc:creator>
    <dc:date>2023-10-31T14:43:41Z</dc:date>
    <item>
      <title>how remove empty values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-remove-empty-values/m-p/900893#M356032</link>
      <description>&lt;P&gt;Dear friends,&lt;/P&gt;&lt;P&gt;I wrote a request only it has a problem that the number of columns is not static but dynamic. Because of this, in my guide they are displayed as a dot and for the catx functions, I have a problem that empty values ​​appear as a dot and a comma (.;.;) in this format. How can I remove empty values to avoid this problem? Thanks for the help.&lt;BR /&gt;I have attached my request. Perhaps it can be solved through the condition, help.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;data mytable;&lt;BR /&gt;set WORK.QUERY_FOR_TRNSTRANSPOSED;&lt;BR /&gt;length result $4100;&lt;BR /&gt;result = catx(';',Столбец1,Столбец2,Столбец3,Столбец4,Столбец5,Столбец6,Столбец7,Столбец8,Столбец9,Столбец10,Столбец11,Столбец12,Столбец13,Столбец14,Столбец15,&lt;BR /&gt;Столбец16,Столбец17,Столбец18,Столбец19,Столбец20,Столбец21,Столбец22,Столбец23,Столбец24,Столбец25,Столбец26,Столбец27,Столбец28,Столбец29,Столбец30,Столбец31,Столбец32,&lt;BR /&gt;Столбец33,Столбец34,Столбец35,Столбец36,Столбец37,Столбец38,Столбец39,Столбец40);&lt;BR /&gt;format result $char.;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 12:14:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-remove-empty-values/m-p/900893#M356032</guid>
      <dc:creator>Satora_In</dc:creator>
      <dc:date>2023-10-31T12:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: how remove empty values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-remove-empty-values/m-p/900901#M356036</link>
      <description>&lt;P&gt;You can try with something similar to the code below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
   input var1 var2 var3 var4 var5;
datalines;
1 . 3 . 5
;
run;

data want(keep=result);
   set have;
   length result $50;
   result = transtrN(catx(';', of var:), ".;", trimn(' '));
   put result=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Oct 2023 12:50:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-remove-empty-values/m-p/900901#M356036</guid>
      <dc:creator>JosvanderVelden</dc:creator>
      <dc:date>2023-10-31T12:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: how remove empty values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-remove-empty-values/m-p/900912#M356041</link>
      <description>&lt;P&gt;Are the variables NUMERIC?&lt;/P&gt;
&lt;P&gt;If so change the MISSING option before running the CAT... function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options missing=' ';
data mytable;
  set WORK.QUERY_FOR_TRNSTRANSPOSED;
  length result $4100;
  result = catx(';', of Столбец1-Столбец40);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;PS: Do NOT attach a FORMAT to a plain text variable.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 13:40:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-remove-empty-values/m-p/900912#M356041</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-10-31T13:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: how remove empty values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-remove-empty-values/m-p/900918#M356045</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please clarify:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) If you have an observation with data like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;a;b;c;.;d;e&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you want the result to have 2 semicolons (";") next to each other, with or without a space, like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;a;b;c;;d;e&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or do you want to remove the semicolon too, like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;a;b;c;d;e&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) If the whole observation looks like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;.;.;.;.;.&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then do you want to output that observation, if yes, then what should the result look like?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If my questions are not clear, then please&amp;nbsp;&lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_blank" rel="noopener"&gt;provide some example data in the form of a data step&lt;/A&gt;, showing input data in one data step and required output in another data step.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks &amp;amp; kind regards,&lt;/P&gt;
&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 14:43:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-remove-empty-values/m-p/900918#M356045</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2023-10-31T14:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: how remove empty values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-remove-empty-values/m-p/900919#M356046</link>
      <description>&lt;P&gt;One approach is to set OPTIONS MISSING=' '; before the data step. That way the conversion of missing values (not empty) will be to a space character. The Catx function will trim leading and trailing spaces before concatenation, so there is no period or space in the result for the missing values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;options missing=' ';
data mytable;
set WORK.QUERY_FOR_TRNSTRANSPOSED;
length result $4100;
result = catx(';',Столбец1,Столбец2,Столбец3,Столбец4,Столбец5,Столбец6,Столбец7,Столбец8,Столбец9,Столбец10,Столбец11,Столбец12,Столбец13,Столбец14,Столбец15,
Столбец16,Столбец17,Столбец18,Столбец19,Столбец20,Столбец21,Столбец22,Столбец23,Столбец24,Столбец25,Столбец26,Столбец27,Столбец28,Столбец29,Столбец30,Столбец31,Столбец32,
Столбец33,Столбец34,Столбец35,Столбец36,Столбец37,Столбец38,Столбец39,Столбец40);
format result $char.;
run;

/* reset to the default */
options missing='.';&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Oct 2023 14:45:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-remove-empty-values/m-p/900919#M356046</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-10-31T14:45:17Z</dc:date>
    </item>
  </channel>
</rss>

