<?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: Shifting data in column to previous column when blank in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170631#M44101</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What if COL also contains comma separator ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile cards dlm="," dsd;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col1 : $12.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col2 : $12.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col3 : $12.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cards;
,rice,beans
,beans,rice
beets,,lettuce
;
run;
data want;
 set have;
 array x{9999} $ 50 _temporary_;
 array c{*} $ col: ;
 n=0;
 do i=1 to dim(c);
&amp;nbsp; if not missing(c{i}) then do;n+1;x{n}=c{i};end;
 end;
 do i=1 to dim(c);
&amp;nbsp; c{i}=x{i};
 end;
 call missing(of x{*});
 drop i n;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 14 Nov 2014 11:38:57 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2014-11-14T11:38:57Z</dc:date>
    <item>
      <title>Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170617#M44087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have 9 columns of data.&amp;nbsp; If column 1 is empty, I want to move the next column to column 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example:&lt;/P&gt;&lt;P&gt;Record 1:&lt;/P&gt;&lt;P&gt;col1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col3&lt;/P&gt;&lt;P&gt;blank&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; beans rice&lt;/P&gt;&lt;P&gt;Record 2:&lt;/P&gt;&lt;P&gt;col1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col3&lt;/P&gt;&lt;P&gt;beets&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; blank&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lettuce&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Desired result:&lt;/P&gt;&lt;P&gt;Record 1 has col1 and col2 populated with beans and rice&lt;/P&gt;&lt;P&gt;Record 2 has col1 and col2 2 populated with beans and lettuce&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for ideas with the quickest approach.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 18:39:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170617#M44087</guid>
      <dc:creator>carmendee</dc:creator>
      <dc:date>2014-11-13T18:39:09Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170618#M44088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does the actual order matter?&lt;/P&gt;&lt;P&gt;And when you say blank do you mean that the value is a zero length string or a string containing only blank characters?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 19:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170618#M44088</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-11-13T19:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170619#M44089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;A string (character) that is blank.&amp;nbsp; Order does not matter.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 19:11:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170619#M44089</guid>
      <dc:creator>carmendee</dc:creator>
      <dc:date>2014-11-13T19:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170620#M44090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You could use an array for the variables, sort the array and you are set. As with sorting the missing value comes first I changed the order of the variables in the array.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;See code sample below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards dlm="," dsd;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; col1 : $12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; col2 : $12.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; col3 : $12.&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; array xcol{*} col3 col2 col1 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; putlog "NOTE: Before Sort: " xcol{*}=;&lt;/P&gt;&lt;P&gt;&amp;nbsp; call sortc( of xcol{*} );&lt;/P&gt;&lt;P&gt;&amp;nbsp; putlog "NOTE: After Sort: " xcol{*}=;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;,beans,rice&lt;/P&gt;&lt;P&gt;beets,,lettuce&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 19:47:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170620#M44090</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2014-11-13T19:47:28Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170621#M44091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data want(drop=i);&lt;/P&gt;&lt;P&gt;set have;&lt;/P&gt;&lt;P&gt;array c(*) col1-col3;&lt;/P&gt;&lt;P&gt;do i=1 to dim(c);&lt;/P&gt;&lt;P&gt;if c{i}=' ' then c{i}=c{i+1};&lt;/P&gt;&lt;P&gt;end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 19:54:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170621#M44091</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2014-11-13T19:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170622#M44092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Like it, since OP stated "Order does not matter.".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 20:01:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170622#M44092</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-11-13T20:01:32Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170623#M44093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I can't see anywhere in OP's request that&amp;nbsp; duplicates are desired.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 20:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170623#M44093</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-11-13T20:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170624#M44094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There will not be duplicates in columns for the row.&amp;nbsp; I will try this!&amp;nbsp; Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 20:05:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170624#M44094</guid>
      <dc:creator>carmendee</dc:creator>
      <dc:date>2014-11-13T20:05:48Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170625#M44095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I asked about order as I was thinking about a SORTC based solution.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 20:49:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170625#M44095</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-11-13T20:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170626#M44096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Need a nested loop to handle more than one blank and to move the blank to the rightmost position(s) and upper limit on the array would be dim(c) -1 to avoid out of bounds errors. Also you want to swap values else the result could result in duplications.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;blank&amp;nbsp; banana orange&lt;/P&gt;&lt;P&gt;would become&lt;/P&gt;&lt;P&gt;banana banana orange&lt;/P&gt;&lt;P&gt;with suggested code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 20:54:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170626#M44096</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-11-13T20:54:04Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170627#M44097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I see. Well, I could have a blank in the first column but not in the other 8 columns, so i would want to shift every column to the left by one column starting with the blank column.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 20:58:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170627#M44097</guid>
      <dc:creator>carmendee</dc:creator>
      <dc:date>2014-11-13T20:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170628#M44098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Figured. &lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://communities.sas.com/i/smilies/16x16_smiley-wink.png" alt="Smiley Wink" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 21:47:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170628#M44098</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-11-13T21:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170629#M44099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you do want 'SHIFTING' without changing the order, here is a simple alternative:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;infile&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;dlm&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;=&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;","&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;dsd&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;input&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col1 : &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$12.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col2 : &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$12.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col3 : &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: teal; background: white;"&gt;$12.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;cards&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;,rice,beans&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;,beans,rice&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: #FFFFC0;"&gt;beets,,lettuce&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;array&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; xcol col1-col3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; cat $ &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-family: 'Courier New';"&gt;50&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cat=catx(&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; background: white;"&gt;','&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;, of xcol(*));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;over&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; xcol;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; xcol=scan(cat,_i_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: blue; background: white;"&gt;keep&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; col:;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; background: white;"&gt;Haikuo &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 22:22:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170629#M44099</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-11-13T22:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170630#M44100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;And handles multiples easily. I like it!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2014 22:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170630#M44100</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2014-11-13T22:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Shifting data in column to previous column when blank</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170631#M44101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What if COL also contains comma separator ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile cards dlm="," dsd;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col1 : $12.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col2 : $12.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; col3 : $12.
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cards;
,rice,beans
,beans,rice
beets,,lettuce
;
run;
data want;
 set have;
 array x{9999} $ 50 _temporary_;
 array c{*} $ col: ;
 n=0;
 do i=1 to dim(c);
&amp;nbsp; if not missing(c{i}) then do;n+1;x{n}=c{i};end;
 end;
 do i=1 to dim(c);
&amp;nbsp; c{i}=x{i};
 end;
 call missing(of x{*});
 drop i n;
run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Nov 2014 11:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Shifting-data-in-column-to-previous-column-when-blank/m-p/170631#M44101</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2014-11-14T11:38:57Z</dc:date>
    </item>
  </channel>
</rss>

