<?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 First time customer appear VS first time File exist in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/First-time-customer-appear-VS-first-time-File-exist/m-p/876849#M346398</link>
    <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;For each customer ID there is information of existence of 5 files (binary variables minus1,minus2,minus3,minus4,minus5).&lt;/P&gt;
&lt;P&gt;There is also information of fist location customer appear.&lt;/P&gt;
&lt;P&gt;I want to create want data set&amp;nbsp; with following information:&lt;/P&gt;
&lt;P&gt;For each customer ID:&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Customer_First_Location&amp;nbsp;(This&amp;nbsp;column&amp;nbsp;already&amp;nbsp;exist&amp;nbsp;in&amp;nbsp;have&amp;nbsp;data&amp;nbsp;set)&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;First_File_Location&amp;nbsp;(New&amp;nbsp;column&amp;nbsp;need&amp;nbsp;to&amp;nbsp;create)&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;status(New&amp;nbsp;column&amp;nbsp;need&amp;nbsp;to&amp;nbsp;create)&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;IF Customer_First_Location =First_File_Location then it is ok.&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;IF&amp;nbsp;Customer_First_Location is after First_File_Location&amp;nbsp;then&amp;nbsp;it&amp;nbsp;is&amp;nbsp;not_ok&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;What is the way to create want data set?&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID  minus1 minus2 minus3 minus4 minus5 Customer_First_Location;
cards;
1 1 1 1 1 1 -1 
2 0 1 0 0 1 -5
3 0 0 0 1 0 -4
4 0 0 0 0 1 . 
;
Run;

Data want;
input ID Customer_First_Location First_File_Location  status;
cards;
1 -1 -1 OK
2 -5 -2 Not_OK
3 -4 -4 OK
4  . -5 Not_OK
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 22 May 2023 06:55:00 GMT</pubDate>
    <dc:creator>Ronein</dc:creator>
    <dc:date>2023-05-22T06:55:00Z</dc:date>
    <item>
      <title>First time customer appear VS first time File exist</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-time-customer-appear-VS-first-time-File-exist/m-p/876849#M346398</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;For each customer ID there is information of existence of 5 files (binary variables minus1,minus2,minus3,minus4,minus5).&lt;/P&gt;
&lt;P&gt;There is also information of fist location customer appear.&lt;/P&gt;
&lt;P&gt;I want to create want data set&amp;nbsp; with following information:&lt;/P&gt;
&lt;P&gt;For each customer ID:&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;Customer_First_Location&amp;nbsp;(This&amp;nbsp;column&amp;nbsp;already&amp;nbsp;exist&amp;nbsp;in&amp;nbsp;have&amp;nbsp;data&amp;nbsp;set)&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;First_File_Location&amp;nbsp;(New&amp;nbsp;column&amp;nbsp;need&amp;nbsp;to&amp;nbsp;create)&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;status(New&amp;nbsp;column&amp;nbsp;need&amp;nbsp;to&amp;nbsp;create)&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;IF Customer_First_Location =First_File_Location then it is ok.&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;IF&amp;nbsp;Customer_First_Location is after First_File_Location&amp;nbsp;then&amp;nbsp;it&amp;nbsp;is&amp;nbsp;not_ok&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;What is the way to create want data set?&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input ID  minus1 minus2 minus3 minus4 minus5 Customer_First_Location;
cards;
1 1 1 1 1 1 -1 
2 0 1 0 0 1 -5
3 0 0 0 1 0 -4
4 0 0 0 0 1 . 
;
Run;

Data want;
input ID Customer_First_Location First_File_Location  status;
cards;
1 -1 -1 OK
2 -5 -2 Not_OK
3 -4 -4 OK
4  . -5 Not_OK
;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 06:55:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-time-customer-appear-VS-first-time-File-exist/m-p/876849#M346398</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2023-05-22T06:55:00Z</dc:date>
    </item>
    <item>
      <title>Re: First time customer appear VS first time File exist</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-time-customer-appear-VS-first-time-File-exist/m-p/876888#M346403</link>
      <description>&lt;P&gt;From&amp;nbsp; your description:&lt;BR /&gt;&amp;gt;&lt;FONT color="#000000"&gt;&lt;STRONG&gt;First_File_Location&amp;nbsp;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;New&amp;nbsp;&lt;SPAN class="token keyword"&gt;column&lt;/SPAN&gt;&amp;nbsp;need&amp;nbsp;&lt;SPAN class="token keyword"&gt;to&lt;/SPAN&gt;&amp;nbsp;create&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;BR /&gt;Nothing in this code indicates how that value is derived.&amp;nbsp;Please explain how you are generating the value for&amp;nbsp;&lt;STRONG&gt;First_File_Location&lt;/STRONG&gt;. &lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 12:22:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-time-customer-appear-VS-first-time-File-exist/m-p/876888#M346403</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2023-05-22T12:22:28Z</dc:date>
    </item>
    <item>
      <title>Re: First time customer appear VS first time File exist</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-time-customer-appear-VS-first-time-File-exist/m-p/876889#M346404</link>
      <description>&lt;P&gt;You have not explained how First_File_Location is created.&lt;/P&gt;</description>
      <pubDate>Mon, 22 May 2023 12:22:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-time-customer-appear-VS-first-time-File-exist/m-p/876889#M346404</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-05-22T12:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: First time customer appear VS first time File exist</title>
      <link>https://communities.sas.com/t5/SAS-Programming/First-time-customer-appear-VS-first-time-File-exist/m-p/876896#M346408</link>
      <description>&lt;P&gt;I took a guess at how to derive first_file_location:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want ;
  set have ;
  length Status $8 ;

  First_File_Location=whichn(1,of minus1-minus5) * -1 ;

  if First_File_Location=Customer_First_Location then status='OK' ;
  else status='Not_OK' ;

run ;

proc print ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 22 May 2023 13:10:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/First-time-customer-appear-VS-first-time-File-exist/m-p/876896#M346408</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-05-22T13:10:37Z</dc:date>
    </item>
  </channel>
</rss>

