<?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 do I create new variable from another variable whose datatype is string in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522751#M141971</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;In my project, I need to find the Locality wise sales of a Cloud kitchen, The dataset is directly from Cloud kitchen's Point of sales. People across 6 km radius can order food online from this restaurant. But for some unknown reason we are getting wrong locality in the variable. But Customer address is correct. This is provided by the customers themself.&amp;nbsp; So if I want to find area wise sales, few observation need to be cleaned according to the correct Location. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Dec 2018 23:39:17 GMT</pubDate>
    <dc:creator>JithinJoe</dc:creator>
    <dc:date>2018-12-19T23:39:17Z</dc:date>
    <item>
      <title>How do I create new variable from another variable whose datatype is string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522728#M141966</link>
      <description>&lt;P&gt;Hello Everyone,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a dataset which contain 2 variable , Locality and Customer address, Due to some reasons, Some values for 'locality' in the dataset doesn't match with customer address.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example in my dataset I have an observation where Locality mentioned as&amp;nbsp;&lt;SPAN&gt;Borough Park ( NY) But the actual Customer location is&amp;nbsp;Kensington (NY).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I need to read the data in Customer address and change the value for locality if it doesn't match with Locality.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;How can I do it in sas programming?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 22:25:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522728#M141966</guid>
      <dc:creator>JithinJoe</dc:creator>
      <dc:date>2018-12-19T22:25:38Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variable from another variable whose datatype is string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522732#M141967</link>
      <description>Well, you'd likely have to show some more examples of what you're trying to do before we can help you. For example, how would you know, looking at a record that Borough Park (NY) is wrong?</description>
      <pubDate>Wed, 19 Dec 2018 22:35:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522732#M141967</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-19T22:35:50Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variable from another variable whose datatype is string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522751#M141971</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;In my project, I need to find the Locality wise sales of a Cloud kitchen, The dataset is directly from Cloud kitchen's Point of sales. People across 6 km radius can order food online from this restaurant. But for some unknown reason we are getting wrong locality in the variable. But Customer address is correct. This is provided by the customers themself.&amp;nbsp; So if I want to find area wise sales, few observation need to be cleaned according to the correct Location. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Dec 2018 23:39:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522751#M141971</guid>
      <dc:creator>JithinJoe</dc:creator>
      <dc:date>2018-12-19T23:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variable from another variable whose datatype is string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522752#M141972</link>
      <description>Ok, but that doesn't answer the question, how do you know a locality is wrong? You looking at it can know, but how else is is known that it's incorrect? Is there a list of valid values? Is it distance based on KM? What happens if a person moves in the middle of making an order, ie I sometimes order delivery on my bus ride home. &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 19 Dec 2018 23:41:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522752#M141972</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-12-19T23:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variable from another variable whose datatype is string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522753#M141973</link>
      <description>&lt;P&gt;Try this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile datalines dlm="|";
  input
  locality: $50.
  customer: $50.
  ;
datalines;
Borough Park ( NY)| Kensington (NY)
Borough Park (_NY)|Borough Park (NY)
Borough Park (NY)|Borough Park (_NY)
Bronx ( NY)|Borough Park (NYC)
;
run;

data WANT;
  set HAVE;
  locality=ifc(locality &amp;lt;&amp;gt; customer,locality, locality);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 19 Dec 2018 23:50:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522753#M141973</guid>
      <dc:creator>ShiroAmada</dc:creator>
      <dc:date>2018-12-19T23:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variable from another variable whose datatype is string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522816#M141995</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; has a very good argument here.&lt;/P&gt;
&lt;P&gt;If locality is the spot from where an order is placed, it should not be changed at all, but kept for further analysis, as it is a very useful datum.&lt;/P&gt;
&lt;P&gt;Imagine a mother, away on a job, ordering food for her kids. She might very well do that online (or per phone call) from San Francisco. Such facts can tell you a lot about your customers.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 09:16:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522816#M141995</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-20T09:16:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I create new variable from another variable whose datatype is string</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522902#M142012</link>
      <description>&lt;P&gt;Without having some kind of well-known rule for the contents of the address variable, this is nearly impossible to accomplish.&amp;nbsp; Parsing addresses from scratch is more of an art than a science.&amp;nbsp; E.g., how to know when the city is two or more words?&amp;nbsp; You need data from outside the application to inform the effort.&amp;nbsp; This is why address correction software is as complex as it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, it is very possible that, for some localities, there are multiple valid city/town names - in such cases it not that the provided locality is wrong, rather that the address correction software used by the client (if they actually do use such) has returned a different but equally valid city name and used that for the locality field they provide. It is also possible that a zip code straddle state lines, so be careful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, to 'fix' the locality to have the exact same value as contained in the address, the address parsing needed can become quite complex. One would likely need to locate and separate out the city, state and zip code (US addresses).&amp;nbsp; Then use a zip/city table to see the known cities/towns for the zip.&amp;nbsp; (SAS actually provides a zip table.)&amp;nbsp; When one of those city/town names is contained within the original address, copy it from the zip table into the (now updated) locality field.&amp;nbsp; This assumes the zip code is correct.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But you still have the problem that both the address and the locality are wrong, but do not match each other.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Dec 2018 16:54:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-do-I-create-new-variable-from-another-variable-whose/m-p/522902#M142012</guid>
      <dc:creator>johnsville</dc:creator>
      <dc:date>2018-12-20T16:54:03Z</dc:date>
    </item>
  </channel>
</rss>

