<?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: Binary Variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251976#M47709</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
location = 'Fake St Main St';
output;
location = '123 Main St';
output;
run;

data want;
set have;
count = 0;
do i = 1 to countw(location);
  if scan(location,i) in ('Ave','St','Dr','Blvd') then count + 1;
end;
dummyvar = count &amp;gt; 1;
keep location dummyvar;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 24 Feb 2016 07:18:07 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2016-02-24T07:18:07Z</dc:date>
    <item>
      <title>Binary Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251887#M47677</link>
      <description>&lt;P&gt;Hello again everyone,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just had another question, this time regarding the creation of a binary variable. &amp;nbsp;I am currently working on a project that has a data set with a large volume of addresses. &amp;nbsp;Some of these addresses are on a street segment, while some others are on street corners. &amp;nbsp;So, my question is how can I write logic for a binary variable that will return a value of 0 or 1 for either a street corner or a street segment? &amp;nbsp;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 22:24:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251887#M47677</guid>
      <dc:creator>DFlynn24</dc:creator>
      <dc:date>2016-02-23T22:24:46Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251888#M47678</link>
      <description>&lt;P&gt;How do you identify a street corner from street segment?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2016 22:26:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251888#M47678</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-23T22:26:33Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251924#M47691</link>
      <description>&lt;P&gt;A street segment has an address like "123 Main Street", while a corner is listed in the dataset like "Main St Fake St". &amp;nbsp;I tried to write a logic statement that would flag any entry under my variable with 2 uses of a word like "St" or "Ave" as a street corner, but I cannot get the IF THEN statement correct&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 00:43:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251924#M47691</guid>
      <dc:creator>DFlynn24</dc:creator>
      <dc:date>2016-02-24T00:43:46Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251929#M47693</link>
      <description>Well, the answer is, identify all possible combinations that identify a corner and classify as 1, else 0.&lt;BR /&gt;&lt;BR /&gt;Reality is, you haven't provided enough information to help. We don't know what your data looks like, what you've tried or what your criteria even clearly is. Please provide more details.</description>
      <pubDate>Wed, 24 Feb 2016 01:08:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251929#M47693</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-24T01:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251952#M47702</link>
      <description>&lt;P&gt;See the thing is, I am not really sure what else I can provide to you, but I'll give it a go. &amp;nbsp;In my data set, the variable I am working with is called "Location". &amp;nbsp;The location is an address that either falls on a street segment (123 Main Street) or a street corner (Corner of Fake Street and Main Street). &amp;nbsp;Street segments are exclusive from street corners and vice versa. &amp;nbsp;So, what I am trying to accomplish is to create a dummy variable, that will either return a 0 for an entry under the "Location" &amp;nbsp;variable&amp;nbsp;on a street segment, and a 1 for an entry under the "Location" variable on a street corner. &amp;nbsp;I think that I can write some sort of conditional statement that will accomplish this for me, but I am not entirely sure how. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is an example of what my data set looks like:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Location:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;123 Main St&lt;/P&gt;&lt;P&gt;12 Third St&lt;/P&gt;&lt;P&gt;Fake St Main St (This is how a street corner was entered into the data set, it was not my doing)&lt;/P&gt;&lt;P&gt;Pennsylvania Ave Main St&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I've Tried:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;The only way I could think to write a conditional expression is something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;IF Location contains "St" or "Ave or "Dr" or "Blvd" (and so on) GREATER THAN OR EQUAL TO 2 times THEN dummyvariable= 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not know if this helped you understand my problem any better, but it is the best I can do&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 03:22:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251952#M47702</guid>
      <dc:creator>DFlynn24</dc:creator>
      <dc:date>2016-02-24T03:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251976#M47709</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
location = 'Fake St Main St';
output;
location = '123 Main St';
output;
run;

data want;
set have;
count = 0;
do i = 1 to countw(location);
  if scan(location,i) in ('Ave','St','Dr','Blvd') then count + 1;
end;
dummyvar = count &amp;gt; 1;
keep location dummyvar;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 24 Feb 2016 07:18:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/251976#M47709</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2016-02-24T07:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: Binary Variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/252070#M47748</link>
      <description>&lt;P&gt;I think Kurt's solution above will work. One suggestion to add on would be to upcase everything for comparison. You can use the upcase function for that.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2016 15:22:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Binary-Variable/m-p/252070#M47748</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-02-24T15:22:45Z</dc:date>
    </item>
  </channel>
</rss>

