<?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: Need Data Step Help in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338248#M76974</link>
    <description>&lt;P&gt;Thanks a million to both Rezza and KSharp. Their timely elegance solutions depicts their smartness, skills and service to SAS communtiy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am very proud !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Girish Patel&lt;/P&gt;</description>
    <pubDate>Sun, 05 Mar 2017 16:16:51 GMT</pubDate>
    <dc:creator>GPatel</dc:creator>
    <dc:date>2017-03-05T16:16:51Z</dc:date>
    <item>
      <title>Need Data Step Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338186#M76942</link>
      <description>&lt;P&gt;Dear SAS Community Members:&lt;BR /&gt; &lt;BR /&gt;I have two SAS data sets VNDR and LKUP as shown below.&lt;BR /&gt; &lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data VNDR; 
Input Name : $ ID City &amp;amp; $11. St : $2. Amt;
datalines;
CNN 100 Atlanta GA 200
ABC 200 Washington DC 150
CBS 300 New York NY 250
CNBC 400 Houston TX 400
;
RUn;

options missing=.;
Data LKup;
infile cards missover;
input CNN ABC CBS CNBC;
cards;
100 . 150 .
. 200 300 350
500 200 300 .
10 20 . 400
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;BR /&gt; &lt;BR /&gt;I would like to have output as shown below:&lt;BR /&gt; &lt;BR /&gt;Match Name / ID from VNDR dataset to LKUP dataset. If Name and ID matches,&lt;BR /&gt;concatenate values of name in a string say Remark seperated by delimeter ';'&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt;Desired Output :&lt;BR /&gt; &lt;/P&gt;
&lt;TABLE style="border-collapse: collapse; width: 390pt;" border="0" width="522" cellspacing="0" cellpadding="0"&gt;&lt;COLGROUP&gt;&lt;COL style="width: 65pt;" span="6" width="87" /&gt; &lt;/COLGROUP&gt;
&lt;TBODY&gt;
&lt;TR style="height: 16.0pt;"&gt;
&lt;TD width="87" height="21" style="height: 16.0pt; width: 65pt;"&gt;Name&lt;/TD&gt;
&lt;TD width="87" style="width: 65pt;"&gt;ID&lt;/TD&gt;
&lt;TD width="87" style="width: 65pt;"&gt;City&lt;/TD&gt;
&lt;TD width="87" style="width: 65pt;"&gt;State&lt;/TD&gt;
&lt;TD width="87" style="width: 65pt;"&gt;Amt&lt;/TD&gt;
&lt;TD width="87" style="width: 65pt;"&gt;Remark&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 16.0pt;"&gt;
&lt;TD height="21" style="height: 16.0pt;"&gt;CNN&lt;/TD&gt;
&lt;TD align="right"&gt;100&lt;/TD&gt;
&lt;TD&gt;Atlanta&lt;/TD&gt;
&lt;TD&gt;GA&lt;/TD&gt;
&lt;TD align="right"&gt;200&lt;/TD&gt;
&lt;TD&gt;CNN:100;ABC:.;CBS:150;CNBC:.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 16.0pt;"&gt;
&lt;TD height="21" style="height: 16.0pt;"&gt;ABC&lt;/TD&gt;
&lt;TD align="right"&gt;200&lt;/TD&gt;
&lt;TD&gt;Washington&lt;/TD&gt;
&lt;TD&gt;DC&lt;/TD&gt;
&lt;TD align="right"&gt;150&lt;/TD&gt;
&lt;TD&gt;ABC:200;CNN:.;CBS:300;CNBC:350&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 16.0pt;"&gt;
&lt;TD height="21" style="height: 16.0pt;"&gt;CBS&lt;/TD&gt;
&lt;TD align="right"&gt;300&lt;/TD&gt;
&lt;TD&gt;New York&lt;/TD&gt;
&lt;TD&gt;NY&lt;/TD&gt;
&lt;TD align="right"&gt;250&lt;/TD&gt;
&lt;TD&gt;CBS:300;CNN:500;ABC:200;CNBC:.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR style="height: 16.0pt;"&gt;
&lt;TD height="21" style="height: 16.0pt;"&gt;CNBC&lt;/TD&gt;
&lt;TD align="right"&gt;400&lt;/TD&gt;
&lt;TD&gt;Houston&lt;/TD&gt;
&lt;TD&gt;TX&lt;/TD&gt;
&lt;TD align="right"&gt;400&lt;/TD&gt;
&lt;TD&gt;CNBC:400;CNN:10;ABC:20;CBS:.&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt; &lt;BR /&gt;Please note that the order of Name in Remark field is not important.&lt;BR /&gt; &lt;BR /&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Sat, 04 Mar 2017 23:42:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338186#M76942</guid>
      <dc:creator>GPatel</dc:creator>
      <dc:date>2017-03-04T23:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need Data Step Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338188#M76943</link>
      <description>&lt;P&gt;How exactly is the matching occuring?&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;CBS 300 has more than one match that I see, could be either the 2nd or 3rd row?&lt;/P&gt;</description>
      <pubDate>Sat, 04 Mar 2017 23:49:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338188#M76943</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-04T23:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Need Data Step Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338192#M76945</link>
      <description>&lt;P&gt;Dear Rezza:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your response. It should be second Row.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2017 00:35:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338192#M76945</guid>
      <dc:creator>GPatel</dc:creator>
      <dc:date>2017-03-05T00:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: Need Data Step Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338195#M76946</link>
      <description>&lt;P&gt;So the rule is first occurrence? Order matters then?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that your sample data is numeric but your text seems to indicate that they may be character values. Any solution would need to be modified if this was the case.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2017 01:22:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338195#M76946</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-03-05T01:22:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need Data Step Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338208#M76953</link>
      <description>&lt;P&gt;I think that the following does what you want:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data VNDR;
  informat Name $4.;
  informat City $11.;
  informat St $2.;
  Input Name ID City &amp;amp; St Amt;
  datalines;
CNN 100 Atlanta  GA 200
ABC 200 Washington  DC 150
CBS 300 New York  NY 250
CNBC 400 Houston  TX 400
;

Data LKup;
infile cards missover;
  input CNN ABC CBS CNBC;
  cards;
100 . 150 .
. 200 300 350
500 200 300 .
10 20 . 400
;

data want;
  set VNDR;
  set LKup;
run;

data want (keep=name city st amt rem);
  set want;
  array stuff CNN--CNBC;
  length rem $255.;
  do over stuff;
    item=catt(vname(stuff),': ',stuff);
    rem=catx('; ',rem,item);
  end;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2017 02:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338208#M76953</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-05T02:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need Data Step Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338217#M76957</link>
      <description>&lt;P&gt;Change something based on Arthur's code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data VNDR;
  informat Name $4.;
  informat City $11.;
  informat St $2.;
  Input Name ID City &amp;amp; St Amt;
  datalines;
CNN 100 Atlanta  GA 200
ABC 200 Washington  DC 150
CBS 300 New York  NY 250
CNBC 400 Houston  TX 400
;

Data LKup;
infile cards missover;
  input CNN ABC CBS CNBC;
  cards;
100 . 150 .
. 200 300 350
500 200 300 .
10 20 . 400
;

data want;
  set VNDR;
  set LKup;
run;

data want (keep=name city st amt want);
  set want;
  array stuff{*} CNN--CNBC;
  length rem want temp $255.;
  do i=1 to dim(stuff);
    if name=vname(stuff{i}) and id=stuff{i} then n=i;
    item=catt(vname(stuff{i}),': ',stuff{i});
    rem=catx('; ',rem,item);
  end;
  
  call scan(rem,n,p,l,';');
  temp=substr(rem,p,l);
  want=cats(temp,';',substrn(rem,1,p-1),substrn(rem,p+l+1));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 05 Mar 2017 04:26:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338217#M76957</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-03-05T04:26:32Z</dc:date>
    </item>
    <item>
      <title>Re: Need Data Step Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338248#M76974</link>
      <description>&lt;P&gt;Thanks a million to both Rezza and KSharp. Their timely elegance solutions depicts their smartness, skills and service to SAS communtiy.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am very proud !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Girish Patel&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2017 16:16:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338248#M76974</guid>
      <dc:creator>GPatel</dc:creator>
      <dc:date>2017-03-05T16:16:51Z</dc:date>
    </item>
    <item>
      <title>Re: Need Data Step Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338250#M76975</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Sorry ....I appolize, I forgot to mention. &amp;nbsp;My sincere thanks too to Mr. Art (CEO, AnalystFinder.com). He did provide timely and great solution to my question.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thanks,&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Girish Patel&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Mar 2017 16:21:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338250#M76975</guid>
      <dc:creator>GPatel</dc:creator>
      <dc:date>2017-03-05T16:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Need Data Step Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338323#M77023</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;Xia, since the OP originally stated "&lt;SPAN&gt;Please note that the order of Name in Remark field is not important.&lt;/SPAN&gt;", why did you post the revised code? Just curious.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 00:07:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338323#M77023</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-06T00:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need Data Step Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338335#M77029</link>
      <description>&lt;P&gt;Arthur,&lt;/P&gt;
&lt;P&gt;Maybe I just ignore these words, or don't understand what OP mean. I just notice the order of names in remark and replicate it .&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 02:13:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338335#M77029</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2017-03-06T02:13:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need Data Step Help</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338338#M77030</link>
      <description>&lt;P&gt;Xia,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Fair enough!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Art&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Mar 2017 02:53:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Data-Step-Help/m-p/338338#M77030</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-03-06T02:53:35Z</dc:date>
    </item>
  </channel>
</rss>

