<?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: How to define Flag to the customer who has more than one account of different types. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-define-Flag-to-the-customer-who-has-more-than-one-account/m-p/227256#M40921</link>
    <description>Thanks a lot...</description>
    <pubDate>Fri, 25 Sep 2015 12:58:51 GMT</pubDate>
    <dc:creator>NagendraBS</dc:creator>
    <dc:date>2015-09-25T12:58:51Z</dc:date>
    <item>
      <title>How to define Flag to the customer who has more than one account of different types.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-define-Flag-to-the-customer-who-has-more-than-one-account/m-p/227220#M40907</link>
      <description>&lt;P&gt;Hi Friends,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please find a soluiton for this,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a dataset with one customer has more than one acount of different types and i need to flag to customer who has web account.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cust acct type flag&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; 201 &amp;nbsp;sav &amp;nbsp; N&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; 202 &amp;nbsp;web &amp;nbsp;Y&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; 203 &amp;nbsp;tda &amp;nbsp; N&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp;204 &amp;nbsp; deb &amp;nbsp;N&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp;301 &amp;nbsp; web Y&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp;302 &amp;nbsp; DEB N&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp;303 &amp;nbsp; web &amp;nbsp;Y&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp;304 &amp;nbsp; sav &amp;nbsp;N&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;Cust &amp;nbsp;acct1 acct2 acct3 acct4 flag&lt;/P&gt;
&lt;P&gt;1 &amp;nbsp; &amp;nbsp; &amp;nbsp; sav &amp;nbsp; &amp;nbsp; web &amp;nbsp; tda &amp;nbsp; &amp;nbsp;deb &amp;nbsp; &amp;nbsp;Y&lt;/P&gt;
&lt;P&gt;2 &amp;nbsp; &amp;nbsp; &amp;nbsp; Web &amp;nbsp; &amp;nbsp;Deb &amp;nbsp; web &amp;nbsp;sav &amp;nbsp; &amp;nbsp;Y&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Nagendra.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 06:03:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-define-Flag-to-the-customer-who-has-more-than-one-account/m-p/227220#M40907</guid>
      <dc:creator>NagendraBS</dc:creator>
      <dc:date>2015-09-25T06:03:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to define Flag to the customer who has more than one account of different types.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-define-Flag-to-the-customer-who-has-more-than-one-account/m-p/227222#M40908</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You could sort by &amp;nbsp;Cust and Flag and keep last record(Y will be after N).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Proc sort data=have;
&amp;nbsp; by cust flag;
run;
&amp;nbsp;
data aux_want;
&amp;nbsp; set have;
&amp;nbsp;&amp;nbsp; by cust flag;
&amp;nbsp; if last.flag;/* If customer have any Y will be the last, if not, flag=N*/
&amp;nbsp; keep cust flag
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will made that you have the same flag for each cust. Then &amp;nbsp;you could transpose your dataset.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
&amp;nbsp; set have;
&amp;nbsp; var='acct'||substr(acct,length(acct),1); /*Name for columns*/
run;
&amp;nbsp;
proc transpose data=have out=want;
&amp;nbsp; by cust;
&amp;nbsp; id var;
&amp;nbsp; var type;
run;
&amp;nbsp;
data want;
&amp;nbsp; merge want
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; aux_want;
&amp;nbsp;&amp;nbsp;by cust;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 07:07:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-define-Flag-to-the-customer-who-has-more-than-one-account/m-p/227222#M40908</guid>
      <dc:creator>arodriguez</dc:creator>
      <dc:date>2015-09-25T07:07:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to define Flag to the customer who has more than one account of different types.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-define-Flag-to-the-customer-who-has-more-than-one-account/m-p/227229#M40909</link>
      <description>&lt;P&gt;Well, I can't see why that structure would be useful, however this code will achieve it:&lt;/P&gt;&lt;P&gt;data have;&lt;BR /&gt;&amp;nbsp; input cust acct type $ flag $;&lt;BR /&gt;datalines;&lt;BR /&gt;1 201 sav N&lt;BR /&gt;1 202 web Y&lt;BR /&gt;1 203 tda N&lt;BR /&gt;1 204 deb N&lt;BR /&gt;2 301 web Y&lt;BR /&gt;2 302 DEB N&lt;BR /&gt;2 303 web Y&lt;BR /&gt;2 304 sav N&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;data want (drop=tmp type i);&lt;BR /&gt;&amp;nbsp; set have (rename=(acct=tmp));&lt;BR /&gt;&amp;nbsp; by cust;&lt;BR /&gt;&amp;nbsp; array acct{4} $3.;&lt;BR /&gt;&amp;nbsp; retain acct1-acct4 has_web i;&lt;BR /&gt;&amp;nbsp; if first.cust then i=1;&lt;BR /&gt;&amp;nbsp; acct{i}=type;&lt;BR /&gt;&amp;nbsp; if type="web" then has_web="Y";&lt;BR /&gt;&amp;nbsp; i=i+1;&lt;BR /&gt;&amp;nbsp; if last.cust then output;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Sep 2015 09:15:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-define-Flag-to-the-customer-who-has-more-than-one-account/m-p/227229#M40909</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-09-25T09:15:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to define Flag to the customer who has more than one account of different types.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-define-Flag-to-the-customer-who-has-more-than-one-account/m-p/227256#M40921</link>
      <description>Thanks a lot...</description>
      <pubDate>Fri, 25 Sep 2015 12:58:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-define-Flag-to-the-customer-who-has-more-than-one-account/m-p/227256#M40921</guid>
      <dc:creator>NagendraBS</dc:creator>
      <dc:date>2015-09-25T12:58:51Z</dc:date>
    </item>
  </channel>
</rss>

