<?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 Question on how to create a column based on the values of another column in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-on-how-to-create-a-column-based-on-the-values-of/m-p/578625#M164136</link>
    <description>&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I am using SAS University Edition.&amp;nbsp; So I need to create a new column based on column x3.&amp;nbsp; The new column is yes/no&amp;nbsp; where 1 is yes and 0 is no.&amp;nbsp; If the value of column x3 is 50 or greater, the new column would indicate 1.&amp;nbsp; If it is less than 50, the new column would indicate no.&amp;nbsp; I have tried various ifelse statements and I cannot seem to get it to work.&amp;nbsp; I am novice to SAS, any help would be appreciated.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 02 Aug 2019 07:09:11 GMT</pubDate>
    <dc:creator>MarvelJJ</dc:creator>
    <dc:date>2019-08-02T07:09:11Z</dc:date>
    <item>
      <title>Question on how to create a column based on the values of another column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-how-to-create-a-column-based-on-the-values-of/m-p/578625#M164136</link>
      <description>&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I am using SAS University Edition.&amp;nbsp; So I need to create a new column based on column x3.&amp;nbsp; The new column is yes/no&amp;nbsp; where 1 is yes and 0 is no.&amp;nbsp; If the value of column x3 is 50 or greater, the new column would indicate 1.&amp;nbsp; If it is less than 50, the new column would indicate no.&amp;nbsp; I have tried various ifelse statements and I cannot seem to get it to work.&amp;nbsp; I am novice to SAS, any help would be appreciated.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 07:09:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-how-to-create-a-column-based-on-the-values-of/m-p/578625#M164136</guid>
      <dc:creator>MarvelJJ</dc:creator>
      <dc:date>2019-08-02T07:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Question on how to create a column based on the values of another column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-how-to-create-a-column-based-on-the-values-of/m-p/578628#M164137</link>
      <description>&lt;P&gt;You should post your code, the log and explain what issues you have.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 07:41:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-how-to-create-a-column-based-on-the-values-of/m-p/578628#M164137</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-08-02T07:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Question on how to create a column based on the values of another column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-how-to-create-a-column-based-on-the-values-of/m-p/578633#M164142</link>
      <description>&lt;P&gt;I am not sure how to get SAS to create the column with the data. I just keep getting errors.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;data work.data;&lt;BR /&gt;	set work.import;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;if x3 &amp;gt; 49 then X7 = 1;&lt;BR /&gt;else if x3 &amp;lt; 50 then x7 = 0;&lt;BR /&gt;run;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 data work.data;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74 set work.import;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 run;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: There were 50 observations read from the data set WORK.CRIME.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.CRIME has 50 observations and 7 variables.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: DATA statement used (Total process time):&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;real time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.00 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78 if x3 &amp;gt; 49 then X7 = 1;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;__&lt;/DIV&gt;&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79 else if x3 &amp;lt; 50 then x7 = 0;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;____&lt;/DIV&gt;&lt;DIV class="sasError"&gt;180&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;80 run;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;82 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2019 08:23:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-how-to-create-a-column-based-on-the-values-of/m-p/578633#M164142</guid>
      <dc:creator>MarvelJJ</dc:creator>
      <dc:date>2019-08-02T08:23:10Z</dc:date>
    </item>
    <item>
      <title>Re: Question on how to create a column based on the values of another column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-how-to-create-a-column-based-on-the-values-of/m-p/578638#M164144</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data work.data;
	set work.import;
run; /* this premature run statement terminates the step and causes the following statements to be invalid */
/* remove it */


if x3 &amp;gt; 49 then X7 = 1;
else if x3 &amp;lt; 50 then x7 = 0;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Aug 2019 08:26:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-how-to-create-a-column-based-on-the-values-of/m-p/578638#M164144</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-08-02T08:26:34Z</dc:date>
    </item>
    <item>
      <title>Re: Question on how to create a column based on the values of another column</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-how-to-create-a-column-based-on-the-values-of/m-p/578639#M164145</link>
      <description>&lt;PRE&gt;data work.data;
	set work.import;
run;


if x3 &amp;gt; 49 then X7 = 1;
else if x3 &amp;lt; 50 then x7 = 0;
run;&lt;/PRE&gt;
&lt;P&gt;Remove the inner "RUN" and test the program. It can also be written as:&lt;/P&gt;
&lt;PRE&gt;data work.data;
	set work.import;
       x7 = 0;
     if x3 &amp;gt; 49 then X7 = 1;
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Aug 2019 08:29:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-how-to-create-a-column-based-on-the-values-of/m-p/578639#M164145</guid>
      <dc:creator>KachiM</dc:creator>
      <dc:date>2019-08-02T08:29:02Z</dc:date>
    </item>
  </channel>
</rss>

