<?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: update blank columns from existing columns in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296270#M20205</link>
    <description>&lt;PRE&gt;

data WORK.TXTFILE;
infile datalines dsd truncover;
input ID:BEST6. DX1:$7. DX2:$7. DX3:$6. DX4:$6. DX5:$5. DX6:$6. DX7:$6. DX8:$5. DX9:$5. DX10:$5. F12:$1. F13:$1. DX11:$5. DX12:$5. DX13:$5.;
datalines4;
147140,O700,O76,Z3A39,Z370,,,,,,,,,D500,D62,D589
141275,I639,I674,F0150,I5042,E854,I10,F17210,I739,I680,K0530,,,Z7982,Z8673,Z9114
120744,O1092,O365930,Z3A40,O99333,O76,O9089,L03311,Z370,O0933,Z23,,,,,
151870,J9621,N170,J9622,R6521,I4901,I4892,I482,I480,B182,B9689,,,D500,D62,D589
161280,Z3831,P0724,P5222,P780,P369,P220,P779,P610,P912,K2971,,,Q443,P8339,P284
129797,Z3801,P220,P0701,P0724,P3639,G039,P271,K4020,,,,,P748,P742,P744
117110,O80,Z370,Z3A39,,,,,,,,,,,,
147647,O480,D649,O99824,O9902,Z370,Z8751,Z3A40,,,,,,Z7982,Z8673,Z9114
120334,O6981X0,O721,O9832,O480,O481,Z87410,O99214,E6601,Z3A41,,,,Z370,,
;;;;
run;
data want;
 set txtfile;
 array x{*} $ dx1-dx10;
 array y{*} $ dx11-dx13;
 n=0;
 do i=1 to dim(x);
  if missing(x{i}) then do;
   n+1;
   if n le dim(y) then x{i}=y{n};
  end;
 end;
 drop i n;
run;


&lt;/PRE&gt;</description>
    <pubDate>Sat, 03 Sep 2016 02:35:38 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2016-09-03T02:35:38Z</dc:date>
    <item>
      <title>update blank columns from existing columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296235#M20201</link>
      <description>&lt;P&gt;Hello Everybody&lt;/P&gt;
&lt;P&gt;I have a table with DX codes from 1 to 13. I received codes dx1-dx10 from one source and DX11-13 from another sources. Now I want to create a final file which has columns&amp;nbsp;upto DX10 with update. since some of the ids do not have DX codes upto 10 I want to update values from DX11-DX13 into DX1-10 when there is no dx code&amp;nbsp;and I have values in DX11-DX13.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Attached documents has current and expected table structure.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12929i59B001579291E47B/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="Tables.PNG" title="Tables.PNG" /&gt;</description>
      <pubDate>Fri, 02 Sep 2016 20:26:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296235#M20201</guid>
      <dc:creator>learner_sas</dc:creator>
      <dc:date>2016-09-02T20:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: update blank columns from existing columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296240#M20202</link>
      <description>&lt;P&gt;It helps to provide data that we can test code on. Most of us are not interested in typing in data. If you have a small example data set you can follow the instructions at this link: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; to create datastep text to recreate you dataset that can then be posted here either by pasting into a window or attaching as TXT file.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 21:13:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296240#M20202</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-02T21:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: update blank columns from existing columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296248#M20203</link>
      <description>&lt;P&gt;Maybe something like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
   set have;
   array d dx1-dx10;
   array a dx11-dx13;
   FirstMiss = findw(catx(',',of d[*]),'.',',','E');
   if 0&amp;lt; FirstMiss le 10 then do i=FirstMiss to (min( 10,Firstmiss+2)) ;
      index =  (i - FirstMiss) +1 ;
      d[i] = a[index];
   end;
   drop firstmiss dx11-dx13;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Sep 2016 21:36:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296248#M20203</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-09-02T21:36:10Z</dc:date>
    </item>
    <item>
      <title>Re: update blank columns from existing columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296259#M20204</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13884"&gt;@ballardw﻿&lt;/a&gt;&amp;nbsp;thank you. Will make sure from next time. Below is the input file. I want to update any missing dignosis between DX1-DX10 using DX11-DX13. &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data WORK.TXTFILE;&lt;BR /&gt; infile datalines dsd truncover;&lt;BR /&gt; input ID:BEST6. DX1:$7. DX2:$7. DX3:$6. DX4:$6. DX5:$5. DX6:$6. DX7:$6. DX8:$5. DX9:$5. DX10:$5. F12:$1. F13:$1. DX11:$5. DX12:$5. DX13:$5.;&lt;BR /&gt;datalines4;&lt;BR /&gt;147140,O700,O76,Z3A39,Z370,,,,,,,,,D500,D62,D589&lt;BR /&gt;141275,I639,I674,F0150,I5042,E854,I10,F17210,I739,I680,K0530,,,Z7982,Z8673,Z9114&lt;BR /&gt;120744,O1092,O365930,Z3A40,O99333,O76,O9089,L03311,Z370,O0933,Z23,,,,,&lt;BR /&gt;151870,J9621,N170,J9622,R6521,I4901,I4892,I482,I480,B182,B9689,,,D500,D62,D589&lt;BR /&gt;161280,Z3831,P0724,P5222,P780,P369,P220,P779,P610,P912,K2971,,,Q443,P8339,P284&lt;BR /&gt;129797,Z3801,P220,P0701,P0724,P3639,G039,P271,K4020,,,,,P748,P742,P744&lt;BR /&gt;117110,O80,Z370,Z3A39,,,,,,,,,,,,&lt;BR /&gt;147647,O480,D649,O99824,O9902,Z370,Z8751,Z3A40,,,,,,Z7982,Z8673,Z9114&lt;BR /&gt;120334,O6981X0,O721,O9832,O480,O481,Z87410,O99214,E6601,Z3A41,,,,Z370,,&lt;BR /&gt;;;;;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 23:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296259#M20204</guid>
      <dc:creator>learner_sas</dc:creator>
      <dc:date>2016-09-02T23:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: update blank columns from existing columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296270#M20205</link>
      <description>&lt;PRE&gt;

data WORK.TXTFILE;
infile datalines dsd truncover;
input ID:BEST6. DX1:$7. DX2:$7. DX3:$6. DX4:$6. DX5:$5. DX6:$6. DX7:$6. DX8:$5. DX9:$5. DX10:$5. F12:$1. F13:$1. DX11:$5. DX12:$5. DX13:$5.;
datalines4;
147140,O700,O76,Z3A39,Z370,,,,,,,,,D500,D62,D589
141275,I639,I674,F0150,I5042,E854,I10,F17210,I739,I680,K0530,,,Z7982,Z8673,Z9114
120744,O1092,O365930,Z3A40,O99333,O76,O9089,L03311,Z370,O0933,Z23,,,,,
151870,J9621,N170,J9622,R6521,I4901,I4892,I482,I480,B182,B9689,,,D500,D62,D589
161280,Z3831,P0724,P5222,P780,P369,P220,P779,P610,P912,K2971,,,Q443,P8339,P284
129797,Z3801,P220,P0701,P0724,P3639,G039,P271,K4020,,,,,P748,P742,P744
117110,O80,Z370,Z3A39,,,,,,,,,,,,
147647,O480,D649,O99824,O9902,Z370,Z8751,Z3A40,,,,,,Z7982,Z8673,Z9114
120334,O6981X0,O721,O9832,O480,O481,Z87410,O99214,E6601,Z3A41,,,,Z370,,
;;;;
run;
data want;
 set txtfile;
 array x{*} $ dx1-dx10;
 array y{*} $ dx11-dx13;
 n=0;
 do i=1 to dim(x);
  if missing(x{i}) then do;
   n+1;
   if n le dim(y) then x{i}=y{n};
  end;
 end;
 drop i n;
run;


&lt;/PRE&gt;</description>
      <pubDate>Sat, 03 Sep 2016 02:35:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296270#M20205</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2016-09-03T02:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: update blank columns from existing columns</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296300#M20206</link>
      <description>Thank you &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;. It worked for me.</description>
      <pubDate>Sat, 03 Sep 2016 11:31:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/update-blank-columns-from-existing-columns/m-p/296300#M20206</guid>
      <dc:creator>learner_sas</dc:creator>
      <dc:date>2016-09-03T11:31:02Z</dc:date>
    </item>
  </channel>
</rss>

