<?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: IF THEN STATEMENT in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39208#M10102</link>
    <description>You could do something like...&lt;BR /&gt;
&lt;BR /&gt;
comb=input(catx(put(A,1.),put(B,1.),put(C,1.)),binary3.);&lt;BR /&gt;
&lt;BR /&gt;
Good luck!</description>
    <pubDate>Mon, 28 Mar 2011 17:56:57 GMT</pubDate>
    <dc:creator>RickM</dc:creator>
    <dc:date>2011-03-28T17:56:57Z</dc:date>
    <item>
      <title>IF THEN STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39207#M10101</link>
      <description>Hello,&lt;BR /&gt;
&lt;BR /&gt;
I am using IF Then statement to label my binary data by their combination. I have 3 binary variables which means 2**3=7 combination:&lt;BR /&gt;
this is my data:&lt;BR /&gt;
A          B          C&lt;BR /&gt;
1           1           1&lt;BR /&gt;
0            0           1&lt;BR /&gt;
and so on&lt;BR /&gt;
&lt;BR /&gt;
so, the first row will be combination 8, 2nd combination 1,....&lt;BR /&gt;
Right now I am using IF Then statement which means 8 lines of "if then" how can I avoid this and use a shorter code?&lt;BR /&gt;
thank you</description>
      <pubDate>Mon, 28 Mar 2011 17:34:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39207#M10101</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-03-28T17:34:53Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39208#M10102</link>
      <description>You could do something like...&lt;BR /&gt;
&lt;BR /&gt;
comb=input(catx(put(A,1.),put(B,1.),put(C,1.)),binary3.);&lt;BR /&gt;
&lt;BR /&gt;
Good luck!</description>
      <pubDate>Mon, 28 Mar 2011 17:56:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39208#M10102</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2011-03-28T17:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39209#M10103</link>
      <description>Thanks Rick,&lt;BR /&gt;
it worked I replaced my code with yours (had to switch 1st statemment with the 2nd). Do you mind explaining what your code did.&lt;BR /&gt;
Thanks again&lt;BR /&gt;
&lt;BR /&gt;
this was my code(long:)):&lt;BR /&gt;
IF SKILLS1=0 and SKILLS2=0 AND SKILLS3=1 THEN COMBINATION=1;&lt;BR /&gt;
if SKILLS1=0 and SKILLS2=1 AND SKILLS3=0 THEN COMBINATION=2;&lt;BR /&gt;
IF SKILLS1=0 and SKILLS2=1 AND SKILLS3=1 THEN COMBINATION=3;&lt;BR /&gt;
IF SKILLS1=1 and SKILLS2=0 AND SKILLS3=0 THEN COMBINATION=4;&lt;BR /&gt;
IF SKILLS1=1 and SKILLS2=0 AND SKILLS3=1 THEN COMBINATION=5;&lt;BR /&gt;
IF SKILLS1=1 and SKILLS2=1 AND SKILLS3=0 THEN COMBINATION=6;&lt;BR /&gt;
IF SKILLS1=1 and SKILLS2=1 AND SKILLS3=1 THEN COMBINATION=7;</description>
      <pubDate>Mon, 28 Mar 2011 18:06:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39209#M10103</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-03-28T18:06:15Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39210#M10104</link>
      <description>It basically concatenated the 0's and 1's into a string ('111', '101', '001', etc) and then that string was converted to a number based on the binary informat.&lt;BR /&gt;
&lt;BR /&gt;
You could also have calculated the binary number from the individual variables.&lt;BR /&gt;
&lt;BR /&gt;
comb=A*2**2+B*2**1+C*2**0;</description>
      <pubDate>Mon, 28 Mar 2011 18:43:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39210#M10104</guid>
      <dc:creator>RickM</dc:creator>
      <dc:date>2011-03-28T18:43:49Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39211#M10105</link>
      <description>thank you so much&lt;BR /&gt;
R.A.G.</description>
      <pubDate>Mon, 28 Mar 2011 22:25:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39211#M10105</guid>
      <dc:creator>R_A_G_</dc:creator>
      <dc:date>2011-03-28T22:25:15Z</dc:date>
    </item>
    <item>
      <title>Re: IF THEN STATEMENT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39212#M10106</link>
      <description>It looks like you are doing convert binary into dec&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data _null_;&lt;BR /&gt;
retain combination -1;&lt;BR /&gt;
 do skills1=0,1;&lt;BR /&gt;
  do skills2=0,1;&lt;BR /&gt;
   do skills3=0,1;&lt;BR /&gt;
    combination+1;&lt;BR /&gt;
    put (_all_) (:);&lt;BR /&gt;
   end;&lt;BR /&gt;
  end;&lt;BR /&gt;
 end;&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Ksharp</description>
      <pubDate>Tue, 29 Mar 2011 01:25:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/IF-THEN-STATEMENT/m-p/39212#M10106</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-03-29T01:25:01Z</dc:date>
    </item>
  </channel>
</rss>

