<?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: create new array based on old array and another library., like excel Vlookup function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875370#M345873</link>
    <description>May instead of keeping the DX1-DX25, you should transpose that data and then join it to the ICD code and you can have all the duplicates in a long dataset format instead?</description>
    <pubDate>Thu, 11 May 2023 22:48:55 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2023-05-11T22:48:55Z</dc:date>
    <item>
      <title>create new array based on old array and another library., like excel Vlookup function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875304#M345851</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;there are 25 variables all with icd code in a sas files a, I need to create another 25 variables come with phecode based on ICD code and phecode library b.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;file a looks like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Id dx1 dx2....dx25;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;file b just have two variables:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;icd phecode&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I want a dataset like:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;id dx1 dx2 ....dx25 phecode1 phecode2 ....phecode25;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I tried below code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;%macro create_phecode_vars;&lt;BR /&gt;%do i = 1 %to 25;&lt;BR /&gt;proc sql;&lt;BR /&gt;create table dxn as&lt;BR /&gt;select a.*, b.phecoden as phecode&amp;amp;i&lt;BR /&gt;from dxn a left join phecn b&lt;BR /&gt;on a.dx&amp;amp;i eq b.icdn&lt;BR /&gt;;&lt;BR /&gt;quit;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Log show WARNING: This CREATE TABLE statement recursively references the target table. A consequence of&lt;BR /&gt;this is a possible data integrity problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Any suggestions are appreciated.&amp;nbsp;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 17:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875304#M345851</guid>
      <dc:creator>Emma21</dc:creator>
      <dc:date>2023-05-11T17:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: create new array based on old array and another library., like excel Vlookup function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875329#M345860</link>
      <description>&lt;P&gt;Use a format instead.&lt;BR /&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings/proceedings/sugi30/001-30.pdf" target="_blank" rel="noopener"&gt;https://support.sas.com/resources/papers/proceedings/proceedings/sugi30/001-30.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data icd_fmt;
set phecn;
fmtname='dxfmt';
type='C';
start=icd;
label = phecode;
run;

proc format cntlin=icd_fmt;
run;

data want;
set have;

array _dx(*) dx1-dx25;
array _phe(*) $10. phecode1-phecode25;

do i=1 to dim(_dx);
if not missing(_dx(i)) then phecode(i) = put(_dx(i), dxfmt.);
end;

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 May 2023 19:14:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875329#M345860</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-05-11T19:14:19Z</dc:date>
    </item>
    <item>
      <title>Re: create new array based on old array and another library., like excel Vlookup function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875333#M345861</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;it shows.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Emma21_0-1683833978749.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/83893iD01B06E20AB7E962/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Emma21_0-1683833978749.png" alt="Emma21_0-1683833978749.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;my icd-phecode library have some repeat code.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Emma21_1-1683834089228.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/83894i675BDC725413F617/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Emma21_1-1683834089228.png" alt="Emma21_1-1683834089228.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 19:41:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875333#M345861</guid>
      <dc:creator>Emma21</dc:creator>
      <dc:date>2023-05-11T19:41:54Z</dc:date>
    </item>
    <item>
      <title>Re: create new array based on old array and another library., like excel Vlookup function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875334#M345862</link>
      <description>How do you want to handle that casem, when you have 20 mapped to both 008 and 0085?</description>
      <pubDate>Thu, 11 May 2023 19:53:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875334#M345862</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-05-11T19:53:27Z</dc:date>
    </item>
    <item>
      <title>Re: create new array based on old array and another library., like excel Vlookup function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875336#M345864</link>
      <description>&lt;P&gt;Yes, I have much more ICD code than Phecode, it is not 1-to -1. I just want to do if dx(i) match icd, then phe(i)=phecode. but my database is big and with repeat.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 20:00:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875336#M345864</guid>
      <dc:creator>Emma21</dc:creator>
      <dc:date>2023-05-11T20:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: create new array based on old array and another library., like excel Vlookup function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875339#M345866</link>
      <description>Your PHEcodes can repeat without issue, the ICD codes should be unique. In the case above, when you have ICD 20, which one should it map to, 008 or 0085? A join would join it to both and duplicate records or you'd have to filter it someway as well. How would you handle it in that case?</description>
      <pubDate>Thu, 11 May 2023 20:27:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875339#M345866</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-05-11T20:27:50Z</dc:date>
    </item>
    <item>
      <title>Re: create new array based on old array and another library., like excel Vlookup function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875366#M345872</link>
      <description>&lt;P&gt;Would it possible to keep all the matched phecode? The file has 155,881 match lines with just 97,852 unique icd code. Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 11 May 2023 22:29:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875366#M345872</guid>
      <dc:creator>Emma21</dc:creator>
      <dc:date>2023-05-11T22:29:43Z</dc:date>
    </item>
    <item>
      <title>Re: create new array based on old array and another library., like excel Vlookup function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875370#M345873</link>
      <description>May instead of keeping the DX1-DX25, you should transpose that data and then join it to the ICD code and you can have all the duplicates in a long dataset format instead?</description>
      <pubDate>Thu, 11 May 2023 22:48:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/create-new-array-based-on-old-array-and-another-library-like/m-p/875370#M345873</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2023-05-11T22:48:55Z</dc:date>
    </item>
  </channel>
</rss>

