<?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: Remove blank cells from a table in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560324#M17154</link>
    <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/170866"&gt;@Giovani&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Taking a chance&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Current;
   input ID name $ Number Street :$12. City :$12.;
   datalines;
101 Riley 1132 . . 
101 Riley . MappleAve . 
101 Riley . . Downtown
101 Riley . . Dream
101 Riley . 5thStreet .
101 Riley 1012 . .
222 Apple 132 . . 
222 Apple . . . 
222 Apple . . Greenville
222 Apple . . York
222 Apple . ElevenAve .
222 Apple 112 . .
;
run;

data temp;
update current(obs=0) current;
by id;
if city&amp;gt;' ' then output;
run;


data want;
set temp;
by id name city	notsorted;
if last.city;
run;




&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;


&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 21 May 2019 02:51:04 GMT</pubDate>
    <dc:creator>novinosrin</dc:creator>
    <dc:date>2019-05-21T02:51:04Z</dc:date>
    <item>
      <title>Remove blank cells from a table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560323#M17153</link>
      <description>&lt;P&gt;Hi SAS experts!&lt;/P&gt;&lt;P&gt;I am facing a situation and I am not sure how to overpass this.&lt;/P&gt;&lt;P&gt;I have a database organized as the data Current. Does anyone know how I can remove the empty cells and create new information as the Desired data?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data Current;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; input ID name $ Number Street $ City $;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; datalines;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;101 Riley 1132 . .&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;101 Riley . MappleAve .&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;101 Riley . . Downtown&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;101 Riley . . Dream&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;101 Riley . 5thStreet .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;101 Riley 1012 . .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;222 Apple 132 . .&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;222 Apple . . .&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;222 Apple . . Greenville&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;222 Apple . . York&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;222 Apple . ElevenAve .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;222 Apple 112 . .&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="s1"&gt;&lt;STRONG&gt;data&lt;/STRONG&gt;&lt;/SPAN&gt; Desired;&lt;/P&gt;&lt;P class="p1"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN class="s2"&gt;input&lt;/SPAN&gt; ID name $ Number Street $ City $;&lt;/P&gt;&lt;P class="p2"&gt;&lt;SPAN class="s3"&gt;&lt;SPAN class="Apple-converted-space"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;datalines&lt;SPAN class="s3"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="p1"&gt;101 Riley 1132 MappleAve Downtown&lt;/P&gt;&lt;P class="p1"&gt;101 Riley 1012 5thStreet Dream&lt;/P&gt;&lt;P class="p1"&gt;222 Apple 132 . Greenville&lt;/P&gt;&lt;P class="p1"&gt;222 Apple 112 ElevenAve York&lt;/P&gt;&lt;P class="p1"&gt;;&lt;/P&gt;&lt;P class="p3"&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;&lt;SPAN class="s3"&gt;;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 02:07:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560323#M17153</guid>
      <dc:creator>Giovani</dc:creator>
      <dc:date>2019-05-21T02:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Remove blank cells from a table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560324#M17154</link>
      <description>&lt;P&gt;hello&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/170866"&gt;@Giovani&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Taking a chance&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Current;
   input ID name $ Number Street :$12. City :$12.;
   datalines;
101 Riley 1132 . . 
101 Riley . MappleAve . 
101 Riley . . Downtown
101 Riley . . Dream
101 Riley . 5thStreet .
101 Riley 1012 . .
222 Apple 132 . . 
222 Apple . . . 
222 Apple . . Greenville
222 Apple . . York
222 Apple . ElevenAve .
222 Apple 112 . .
;
run;

data temp;
update current(obs=0) current;
by id;
if city&amp;gt;' ' then output;
run;


data want;
set temp;
by id name city	notsorted;
if last.city;
run;




&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;


&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 02:51:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560324#M17154</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-05-21T02:51:04Z</dc:date>
    </item>
    <item>
      <title>Re: Remove blank cells from a table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560331#M17155</link>
      <description>&lt;P&gt;Assuming you want a new address when a new id, name, number, street or city is encountered:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
set current; by id name;
length _N 8 _S _C $24;
retain _N _S _C;
if  not missing(_N) and not missing(Number) or
    not missing(_S) and not missing(Street) or
    not missing(_C) and not missing(City) then do;
    output;
    call missing(_N, _S, _C);
    end;
_N = coalesce(_N, Number);
_S = coalescec(_S, Street);
_C = coalescec(_C, City);
if last.name then do;
    output;
    call missing(_N, _S, _C);
    end;
keep ID name _N _S _C;
rename _N=Number _S=Street _C=City;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 May 2019 03:29:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560331#M17155</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-05-21T03:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Remove blank cells from a table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560610#M17165</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138205"&gt;@novinosrin&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your solution was not able to handle when I had more them 2 information's per ID like in the case bellow&lt;/P&gt;&lt;P&gt;data Current;&lt;BR /&gt;input ID name $ Number $ Street $ City $;&lt;BR /&gt;datalines;&lt;BR /&gt;101 Riley 1132A . .&lt;BR /&gt;101 Riley . MappleAve .&lt;BR /&gt;101 Riley . . Downtown&lt;BR /&gt;101 Riley . . Dream&lt;BR /&gt;101 Riley . 5thStreet .&lt;BR /&gt;101 Riley 1012A . .&lt;BR /&gt;101 Riley . . Dreams&lt;BR /&gt;101 Riley . 4thStreet .&lt;BR /&gt;101 Riley 1013B . .&lt;BR /&gt;101 Riley 1014CB . .&lt;BR /&gt;101 Riley . . Life&lt;BR /&gt;101 Riley . 3thStreet .&lt;BR /&gt;222 Apple B132 . .&lt;BR /&gt;222 Apple . . .&lt;BR /&gt;222 Apple . . Greenville&lt;BR /&gt;222 Apple . . York&lt;BR /&gt;222 Apple . ElevenAve .&lt;BR /&gt;222 Apple A112 . .&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data Desired;&lt;BR /&gt;input ID name $ Number $ Street $ City $;&lt;BR /&gt;datalines;&lt;BR /&gt;101 Riley 1132A MappleAve Downtown&lt;BR /&gt;101 Riley 1012A 5thStreet Dream&lt;BR /&gt;101 Riley 1013B 4thStreet Dream&lt;BR /&gt;101 Riley 1014C 3thStreet Life&lt;BR /&gt;222 Apple B132 . Greenville&lt;BR /&gt;222 Apple A112 ElevenAve York&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 18:27:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560610#M17165</guid>
      <dc:creator>Giovani</dc:creator>
      <dc:date>2019-05-21T18:27:19Z</dc:date>
    </item>
    <item>
      <title>Re: Remove blank cells from a table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560612#M17166</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your solutions it seem to be close to handle the issue. I release that I have a information's for my variable named as "Number" as character and not numeric. Any idea how overpass this error "Invalid numeric data, Number='1132A'" ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data Current;&lt;BR /&gt;input ID name $ Number $ Street $ City $;&lt;BR /&gt;datalines;&lt;BR /&gt;101 Riley 1132A . .&lt;BR /&gt;101 Riley . MappleAve .&lt;BR /&gt;101 Riley . . Downtown&lt;BR /&gt;101 Riley . . Dream&lt;BR /&gt;101 Riley . 5thStreet .&lt;BR /&gt;101 Riley 1012A . .&lt;BR /&gt;101 Riley . . Dreams&lt;BR /&gt;101 Riley . 4thStreet .&lt;BR /&gt;101 Riley 1013B . .&lt;BR /&gt;101 Riley 1014CB . .&lt;BR /&gt;101 Riley . . Life&lt;BR /&gt;101 Riley . 3thStreet .&lt;BR /&gt;222 Apple B132 . .&lt;BR /&gt;222 Apple . . .&lt;BR /&gt;222 Apple . . Greenville&lt;BR /&gt;222 Apple . . York&lt;BR /&gt;222 Apple . ElevenAve .&lt;BR /&gt;222 Apple A112 . .&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;data want2;&lt;BR /&gt;set current; by id name;&lt;BR /&gt;length _N 8 _S _C $24;&lt;BR /&gt;retain _N _S _C;&lt;BR /&gt;if not missing(_N) and not missing(Number) or&lt;BR /&gt;not missing(_S) and not missing(Street) or&lt;BR /&gt;not missing(_C) and not missing(City) then do;&lt;BR /&gt;output;&lt;BR /&gt;call missing(_N, _S, _C);&lt;BR /&gt;end;&lt;BR /&gt;_N = coalesce(_N, Number);&lt;BR /&gt;_S = coalescec(_S, Street);&lt;BR /&gt;_C = coalescec(_C, City);&lt;BR /&gt;if last.name then do;&lt;BR /&gt;output;&lt;BR /&gt;call missing(_N, _S, _C);&lt;BR /&gt;end;&lt;BR /&gt;keep ID name _N _S _C;&lt;BR /&gt;rename _N=Number _S=Street _C=City;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 18:31:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560612#M17166</guid>
      <dc:creator>Giovani</dc:creator>
      <dc:date>2019-05-21T18:31:56Z</dc:date>
    </item>
    <item>
      <title>Re: Remove blank cells from a table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560622#M17167</link>
      <description>&lt;P&gt;Almost nothing to change. Can you spot the differences? Make sure you understand the code before using it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data Current;
input ID name $ Number $ Street $ City $;
datalines;
101 Riley 1132A . .
101 Riley . MappleAve .
101 Riley . . Downtown
101 Riley . . Dream
101 Riley . 5thStreet .
101 Riley 1012A . .
101 Riley . . Dreams
101 Riley . 4thStreet .
101 Riley 1013B . .
101 Riley 1014CB . .
101 Riley . . Life
101 Riley . 3thStreet .
222 Apple B132 . .
222 Apple . . .
222 Apple . . Greenville
222 Apple . . York
222 Apple . ElevenAve .
222 Apple A112 . .
;

data want;
set current; by id name;
length _N _S _C $24;
retain _N _S _C;
if  not missing(_N) and not missing(Number) or
    not missing(_S) and not missing(Street) or
    not missing(_C) and not missing(City) then do;
    output;
    call missing(_N, _S, _C);
    end;
_N = coalescec(_N, Number);
_S = coalescec(_S, Street);
_C = coalescec(_C, City);
if last.name then do;
    output;
    call missing(_N, _S, _C);
    end;
keep ID name _N _S _C;
rename _N=Number _S=Street _C=City;
run;

proc print data=want noobs;
run;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 May 2019 19:14:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560622#M17167</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2019-05-21T19:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Remove blank cells from a table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560624#M17168</link>
      <description>&lt;P&gt;What exactly is the logic for creating those particular rows to output?&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2019 19:25:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560624#M17168</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-21T19:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Remove blank cells from a table</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560628#M17169</link>
      <description>Organizing data from a vertical to horizontal format for further graphic visualization</description>
      <pubDate>Tue, 21 May 2019 19:41:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/Remove-blank-cells-from-a-table/m-p/560628#M17169</guid>
      <dc:creator>Giovani</dc:creator>
      <dc:date>2019-05-21T19:41:01Z</dc:date>
    </item>
  </channel>
</rss>

