<?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 Help !!! in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-Help/m-p/457146#M115876</link>
    <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Support-Communities/How-to-ask-a-good-question-and-receive-a-fast-reply/ta-p/417192" target="_blank"&gt;https://communities.sas.com/t5/SAS-Support-Communities/How-to-ask-a-good-question-and-receive-a-fast-reply/ta-p/417192&amp;nbsp;&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 25 Apr 2018 03:27:20 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2018-04-25T03:27:20Z</dc:date>
    <item>
      <title>Need Help !!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Help/m-p/457141#M115873</link>
      <description>&lt;P&gt;Hi ,I have the following sample and am looking for help.&amp;nbsp; Thanks in advance.&lt;/P&gt;&lt;P&gt;ID&amp;nbsp; Ticket &amp;nbsp; Date1&amp;nbsp; Data2&amp;nbsp; Code1 Code2 Code3 Code4 Cod5&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;&amp;nbsp; clm1 &amp;nbsp; &amp;nbsp; Jan &amp;nbsp; &amp;nbsp;&amp;nbsp; Feb &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; V01 &amp;nbsp; &amp;nbsp; V02 &amp;nbsp; &amp;nbsp;&amp;nbsp; E25 &amp;nbsp;&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;&amp;nbsp; clm2 &amp;nbsp; &amp;nbsp; Feb &amp;nbsp; &amp;nbsp;&amp;nbsp; Mar &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; D01 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; C02&lt;/P&gt;&lt;P&gt;1 &amp;nbsp;&amp;nbsp; clm3 &amp;nbsp; &amp;nbsp; Mar &amp;nbsp; &amp;nbsp;&amp;nbsp; Apr &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; B01 &amp;nbsp;&amp;nbsp; V02&lt;/P&gt;&lt;P&gt;2 &amp;nbsp;&amp;nbsp; clm1 &amp;nbsp; &amp;nbsp;&amp;nbsp; Jan &amp;nbsp; &amp;nbsp; &amp;nbsp; Mar &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B01&lt;/P&gt;&lt;P&gt;3 &amp;nbsp;&amp;nbsp; clm1 &amp;nbsp; &amp;nbsp;&amp;nbsp; Jan &amp;nbsp; &amp;nbsp; May &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; B01 &amp;nbsp;&amp;nbsp; C01 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; D01&lt;/P&gt;&lt;P&gt;3 &amp;nbsp;&amp;nbsp; clm2 &amp;nbsp; &amp;nbsp; &amp;nbsp; Feb &amp;nbsp; &amp;nbsp; Jun &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; V01 &amp;nbsp;&amp;nbsp; E02&lt;/P&gt;&lt;P&gt;Result Group ID:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data want;
 set have;&lt;BR /&gt;  &lt;BR /&gt;&lt;BR /&gt;  run;&lt;BR /&gt;   &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;ID&amp;nbsp; Ticket &amp;nbsp; Date1&amp;nbsp; Data2&amp;nbsp; 1stCode&amp;nbsp; 2ndCode &amp;nbsp; &amp;nbsp; Ticket &amp;nbsp; Date1&amp;nbsp; Data2&amp;nbsp; 1stCode&amp;nbsp; 2ndCode &amp;nbsp;&amp;nbsp; Ticket &amp;nbsp; Date1&amp;nbsp; Data2&amp;nbsp; 1stCode 2ndCode1&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;1 &amp;nbsp; &amp;nbsp; clm1 &amp;nbsp; &amp;nbsp; Jan &amp;nbsp; &amp;nbsp; Feb &amp;nbsp; &amp;nbsp;&amp;nbsp; V01 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; V02 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Clm2 &amp;nbsp;&amp;nbsp; Feb &amp;nbsp; &amp;nbsp;&amp;nbsp; Mar &amp;nbsp; &amp;nbsp; D01 &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; C02 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; clm3 &amp;nbsp; &amp;nbsp; Mar &amp;nbsp; &amp;nbsp; Apr &amp;nbsp; &amp;nbsp; &amp;nbsp; B01 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; V02&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;2 &amp;nbsp; &amp;nbsp; clm2 &amp;nbsp; &amp;nbsp;&amp;nbsp; Jan &amp;nbsp; &amp;nbsp; Mar &amp;nbsp; &amp;nbsp;&amp;nbsp; B01&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3 &amp;nbsp; &amp;nbsp; clm1 &amp;nbsp; &amp;nbsp; &amp;nbsp; Jan &amp;nbsp;&amp;nbsp; May &amp;nbsp; &amp;nbsp;&amp;nbsp; B01 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; C01 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; clm2 &amp;nbsp; &amp;nbsp; Feb &amp;nbsp; &amp;nbsp; &amp;nbsp; Jun &amp;nbsp;&amp;nbsp; V01 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; E02&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 02:50:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Help/m-p/457141#M115873</guid>
      <dc:creator>vtan9999</dc:creator>
      <dc:date>2018-04-25T02:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help !!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Help/m-p/457146#M115876</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Support-Communities/How-to-ask-a-good-question-and-receive-a-fast-reply/ta-p/417192" target="_blank"&gt;https://communities.sas.com/t5/SAS-Support-Communities/How-to-ask-a-good-question-and-receive-a-fast-reply/ta-p/417192&amp;nbsp;&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 03:27:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Help/m-p/457146#M115876</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-04-25T03:27:20Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help !!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Help/m-p/457278#M115918</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
infile cards truncover;
input ID  (Ticket   Date1  Date2  Code1 Code2 Code3 Code4 Code5) ($);
cards;
1    clm1     Jan      Feb          .        V01     V02      E25  
1    clm2     Feb      Mar        D01       . .                     C02
1    clm3     Mar      Apr           . . .                      B01    V02
2    clm1      Jan       Mar       . . .  .                      B01
3    clm1      Jan     May          .           B01    C01       .         D01
3    clm2       Feb     Jun       .  .                       V01    E02 .
;
run;
data temp;
 set have;
 array x{*} $ code:;
 x1=scan(catx('|',of x{*}),1,'|');
 x2=scan(catx('|',of x{*}),2,'|');
run;
proc sql noprint;
select max(n) into : n
 from (select count(*) as n from have group by id);
quit;
proc summary data=temp;
by id ;
output out=want idgroup(out[&amp;amp;n] (ticket date1 date2 x1 x2)=);
run;
proc print noobs;run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 25 Apr 2018 13:43:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Help/m-p/457278#M115918</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-04-25T13:43:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help !!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Help/m-p/457443#M115982</link>
      <description>&lt;P&gt;Thank you, &lt;A href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408" target="_self"&gt;&lt;SPAN class="login-bold"&gt;Ksharp&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;.&amp;nbsp;The program below works as what I expect.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; temp&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt; have&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token statement"&gt;array&lt;/SPAN&gt; x&lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;}&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;$&lt;/SPAN&gt; code:&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;x1&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;catx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'|'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;of x&lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;}&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;1&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'|'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;x2&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;scan&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;catx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'|'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;of x&lt;SPAN class="token punctuation"&gt;{&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;}&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;2&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'|'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;However, the last program run into problem.&amp;nbsp; The proc summary run into problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;summary&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;temp;&lt;BR /&gt;&lt;SPAN class="token statement"&gt;by&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;id&lt;/SPAN&gt; ;&lt;BR /&gt;output out&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;want idgroup(out[&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;n&lt;/SPAN&gt;] (ticket date1 date2 x1 x2)&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;;&lt;BR /&gt;&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;print&lt;/SPAN&gt; noobs;&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token punctuation"&gt;&amp;nbsp; Here is what it displays:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;"The parameter value 17641 is not within the required range of 1 and 100".&amp;nbsp;&amp;nbsp; I work around by creating 3 data steps and merge them back at the end.&amp;nbsp; It works fine but I am looking for a better way to do.&amp;nbsp; Thanks for your input.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Apr 2018 18:29:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Help/m-p/457443#M115982</guid>
      <dc:creator>vtan9999</dc:creator>
      <dc:date>2018-04-25T18:29:00Z</dc:date>
    </item>
    <item>
      <title>Re: Need Help !!!</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-Help/m-p/457692#M116064</link>
      <description>&lt;PRE&gt;
I can't believe you need so many variables.
Check MERGE Skill proposed by me,Matt,Arthur.T
http://support.sas.com/resources/papers/proceedings15/2785-2015.pdf


data have;
infile cards truncover;
input ID  (Ticket   Date1  Date2  Code1 Code2 Code3 Code4 Code5) ($);
cards;
1    clm1     Jan      Feb          .        V01     V02      E25  
1    clm2     Feb      Mar        D01       . .                     C02
1    clm3     Mar      Apr           . . .                      B01    V02
2    clm1      Jan       Mar       . . .  .                      B01
3    clm1      Jan     May          .           B01    C01       .         D01
3    clm2       Feb     Jun       .  .                       V01    E02 .
;
run;
data temp;
 set have;
 by id;
 if first.id then n=0;
 n+1;
 array x{*} $ code:;
 x1=scan(catx('|',of x{*}),1,'|');
 x2=scan(catx('|',of x{*}),2,'|');
 keep id ticket date1 date2 x1 x2 n;
run;
proc freq data=temp noprint;
table n/out=key nopercent;
run;
data _null_;
 set key end=last;
 if _n_=1 then call execute('data want;merge ');
 call execute(catt('temp(where=(n=',n,') rename=(ticket=ticket_',n,' 
 date1=date1_',n,' date2=date2_',n,' x1=x1_',n,' x2=x2_',n,'))'));
 if last then call execute(';by id;drop n;run;');
run;
&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 Apr 2018 12:33:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-Help/m-p/457692#M116064</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-04-26T12:33:02Z</dc:date>
    </item>
  </channel>
</rss>

