<?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: ISSUE - Variable and Condition in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/ISSUE-Variable-and-Condition/m-p/21607#M4607</link>
    <description>Hi &lt;B&gt;Pappu&lt;/B&gt;,&lt;BR /&gt;
&lt;BR /&gt;
Here is an example of the code:&lt;BR /&gt;
&lt;BR /&gt;
data income;&lt;BR /&gt;
input ID $ Age Income;&lt;BR /&gt;
if income in (2000,1500,3200) then do;&lt;BR /&gt;
   if age in (23,34) then Known=1;&lt;BR /&gt;
   else Known=0; end;&lt;BR /&gt;
else Known=0;&lt;BR /&gt;
datalines;&lt;BR /&gt;
001 23 2000&lt;BR /&gt;
002 23 3000&lt;BR /&gt;
003 34 3200&lt;BR /&gt;
004 34 4000&lt;BR /&gt;
005 24 2000&lt;BR /&gt;
006 25 3000&lt;BR /&gt;
007 38 1500&lt;BR /&gt;
008 36 4000&lt;BR /&gt;
;&lt;BR /&gt;
proc print noobs;&lt;BR /&gt;
title "Income and Age checked";&lt;BR /&gt;
run;</description>
    <pubDate>Tue, 21 Apr 2009 18:50:08 GMT</pubDate>
    <dc:creator>statsplank</dc:creator>
    <dc:date>2009-04-21T18:50:08Z</dc:date>
    <item>
      <title>ISSUE - Variable and Condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ISSUE-Variable-and-Condition/m-p/21605#M4605</link>
      <description>Hello All&lt;BR /&gt;
&lt;BR /&gt;
I am trying to create a variable "Known" and assign it a value of either 1 or 0 based on the Age and Income range for each ID.&lt;BR /&gt;
&lt;BR /&gt;
Here is the data I have:&lt;BR /&gt;
ID     Age     Income        Known&lt;BR /&gt;
001   23       2000            if (income = 2000 or 1500 or 3200) and if (age = 23 or age = 34) then 1 else 0.&lt;BR /&gt;
&lt;BR /&gt;
I have about 1 million observations for the variable - ID and I have to generate a value for Known for each observation.&lt;BR /&gt;
&lt;BR /&gt;
How would I be able to create a variable and assign a condition in the data statement?&lt;BR /&gt;
&lt;BR /&gt;
Thanks for all your help.&lt;BR /&gt;
P</description>
      <pubDate>Tue, 21 Apr 2009 16:28:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ISSUE-Variable-and-Condition/m-p/21605#M4605</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-21T16:28:17Z</dc:date>
    </item>
    <item>
      <title>Re: ISSUE - Variable and Condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ISSUE-Variable-and-Condition/m-p/21606#M4606</link>
      <description>In a DATA step, use the SAS programming logic:&lt;BR /&gt;
&lt;BR /&gt;
IF &lt;CONDITION&gt; THEN &lt;ASSIGNMENT&gt;;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
The SAS support  &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website has a wealth of SAS product documentation resources and also supplemental technical and conference papers and sample code for specific topic points.  Using the SEARCH facility, I found one such conference paper - link provided below:&lt;BR /&gt;
&lt;BR /&gt;
A Hands-On Introduction to SAS® DATA Step Programming&lt;BR /&gt;
Debbie Buck, D. B. &amp;amp; P. Associates, Houston, TX&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi30/134-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/134-30.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Also, here is a SAS DOC link on DATA Step discussion:&lt;BR /&gt;
&lt;BR /&gt;
DATA Step Processing&lt;BR /&gt;
&lt;A href="http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001281588.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a001281588.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.&lt;/ASSIGNMENT&gt;&lt;/CONDITION&gt;</description>
      <pubDate>Tue, 21 Apr 2009 17:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ISSUE-Variable-and-Condition/m-p/21606#M4606</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-04-21T17:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: ISSUE - Variable and Condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ISSUE-Variable-and-Condition/m-p/21607#M4607</link>
      <description>Hi &lt;B&gt;Pappu&lt;/B&gt;,&lt;BR /&gt;
&lt;BR /&gt;
Here is an example of the code:&lt;BR /&gt;
&lt;BR /&gt;
data income;&lt;BR /&gt;
input ID $ Age Income;&lt;BR /&gt;
if income in (2000,1500,3200) then do;&lt;BR /&gt;
   if age in (23,34) then Known=1;&lt;BR /&gt;
   else Known=0; end;&lt;BR /&gt;
else Known=0;&lt;BR /&gt;
datalines;&lt;BR /&gt;
001 23 2000&lt;BR /&gt;
002 23 3000&lt;BR /&gt;
003 34 3200&lt;BR /&gt;
004 34 4000&lt;BR /&gt;
005 24 2000&lt;BR /&gt;
006 25 3000&lt;BR /&gt;
007 38 1500&lt;BR /&gt;
008 36 4000&lt;BR /&gt;
;&lt;BR /&gt;
proc print noobs;&lt;BR /&gt;
title "Income and Age checked";&lt;BR /&gt;
run;</description>
      <pubDate>Tue, 21 Apr 2009 18:50:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ISSUE-Variable-and-Condition/m-p/21607#M4607</guid>
      <dc:creator>statsplank</dc:creator>
      <dc:date>2009-04-21T18:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: ISSUE - Variable and Condition</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/ISSUE-Variable-and-Condition/m-p/21608#M4608</link>
      <description>Thanks everybody!!!! It works</description>
      <pubDate>Tue, 21 Apr 2009 20:50:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/ISSUE-Variable-and-Condition/m-p/21608#M4608</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-21T20:50:07Z</dc:date>
    </item>
  </channel>
</rss>

