<?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: New variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/783956#M250092</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/408725"&gt;@katez01&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a;&lt;/P&gt;
&lt;P&gt;if class_new = &lt;U&gt;1,2,3,4&lt;/U&gt;&amp;nbsp;(is this correct?) then class_new_final= "final classes";&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if class_new in (1,2,3,4) then ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but I really don't understand the part&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;then class_new_final= "final classes";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but maybe that doesn't really matter here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course you could simplify the code even further by using working with the original variable named CLASS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if class in (1,2,3,5) then ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then you don't need all those IF statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your data steps probably need a SET statement or an INPUT statement.&lt;/P&gt;</description>
    <pubDate>Fri, 03 Dec 2021 16:13:34 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2021-12-03T16:13:34Z</dc:date>
    <item>
      <title>New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/783955#M250091</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a new variable based on a re-ordered variable that includes groups 1,2,3,4 only (not group 5). I have reordered the variable below, but cannot figure out how to create a new variable that includes groups 1,2,3,4. I want to then work with this new variable to run the rest of my coding...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data a;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if class = 1 then class_new = 1;&lt;BR /&gt;if class = 2 then class_new = 2;&lt;BR /&gt;if class = 3 then class_new = 3;&lt;BR /&gt;if class = 4 then class_new = 5;&lt;BR /&gt;if class = 5 then class_new = 4;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data a;&lt;/P&gt;&lt;P&gt;if class_new = &lt;U&gt;1,2,3,4&lt;/U&gt;&amp;nbsp;(is this correct?) then class_new_final= "final classes";&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 15:58:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/783955#M250091</guid>
      <dc:creator>katez01</dc:creator>
      <dc:date>2021-12-03T15:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/783956#M250092</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/408725"&gt;@katez01&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a;&lt;/P&gt;
&lt;P&gt;if class_new = &lt;U&gt;1,2,3,4&lt;/U&gt;&amp;nbsp;(is this correct?) then class_new_final= "final classes";&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think you want&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if class_new in (1,2,3,4) then ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but I really don't understand the part&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;then class_new_final= "final classes";&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but maybe that doesn't really matter here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Of course you could simplify the code even further by using working with the original variable named CLASS&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if class in (1,2,3,5) then ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then you don't need all those IF statements.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your data steps probably need a SET statement or an INPUT statement.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 16:13:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/783956#M250092</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-12-03T16:13:34Z</dc:date>
    </item>
    <item>
      <title>Re: New variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/783981#M250098</link>
      <description>&lt;P&gt;Presumably you already have a data set that contains CLASS.&amp;nbsp; To use that data set, you need to use a SET statement.&amp;nbsp; For example, if the name of the data set that contains CLASS is A, you need:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data new;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;set a;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;... whatever changes you want to make, such as creating class_final ...;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you use this statement instead, you will destroy your existing data set:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data a;&lt;/P&gt;</description>
      <pubDate>Fri, 03 Dec 2021 18:13:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/New-variable/m-p/783981#M250098</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2021-12-03T18:13:00Z</dc:date>
    </item>
  </channel>
</rss>

