<?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: modify all the observations of all the variables in a dataset in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143091#M28633</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Amir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hehe, thanks for pointing that out. as you correctly noticed, i didnt notice that &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; learned sth. new again, have to look into that when i finish the current task...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;have a great day.&amp;nbsp; Dingdang &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Nov 2013 17:33:59 GMT</pubDate>
    <dc:creator>Dingdang</dc:creator>
    <dc:date>2013-11-14T17:33:59Z</dc:date>
    <item>
      <title>modify all the observations of all the variables in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143084#M28626</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I used proc compare to compare the values of two data sets and put the differences into a dataset work.comp. So work.comp looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="99" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; WIDTH: 1032px; HEIGHT: 85px; BORDER-TOP: #000000 1px solid; BORDER-RIGHT: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Observationtype&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Observationnummer&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Var1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Var2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Var3&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;DIF&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;-20&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;-10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;DIF&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;100&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;30&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;DIF&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;50&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;-10&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to update this table with the following rules: for all the variables, if the observation is bigger than 0, then replace the observationvalue with '1' else replace with '0'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the example above will then look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" height="99" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; WIDTH: 1031px; HEIGHT: 82px; BORDER-TOP: #000000 1px solid; BORDER-RIGHT: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Observationtype&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Header 2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Var1&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Var2&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Var3&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;DIF&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;DIF&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;2&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;DIF&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;3&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;1&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many many thanks again for the help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&amp;nbsp; Dingdang&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 09:16:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143084#M28626</guid>
      <dc:creator>Dingdang</dc:creator>
      <dc:date>2013-11-14T09:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: modify all the observations of all the variables in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143085#M28627</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;data work.comp;&lt;/P&gt;&lt;P&gt;set work.comp ;&lt;/P&gt;&lt;P&gt;if var1&amp;lt;=0 then var1=0 ;else var1=1;&lt;/P&gt;&lt;P&gt;if var2&amp;lt;=0 then var2=0 ;else var2=1;&lt;/P&gt;&lt;P&gt;if var3&amp;lt;=0 then var3=0 ;else var3=1;&lt;/P&gt;&lt;P&gt;;run;&lt;/P&gt;&lt;P&gt;proc print;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 09:45:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143085#M28627</guid>
      <dc:creator>pradeepalankar</dc:creator>
      <dc:date>2013-11-14T09:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: modify all the observations of all the variables in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143086#M28628</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;alternatively, if you have many variables to change then arrays will be a good option&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; array vars(*) var1 - var3;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i =1 to dim(vars);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if vars(i) &amp;gt; 0 then vars(i)=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else vars(i)=0; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;jagadish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 10:16:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143086#M28628</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2013-11-14T10:16:22Z</dc:date>
    </item>
    <item>
      <title>Re: modify all the observations of all the variables in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143087#M28629</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi Jagadish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;this is exactly what i am looking for. I wrote sth. similar but i used {} instead of () to address the elements in the array. I think I need to look into the differences between () [] and {}.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again. BR&amp;nbsp; Dingdang &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 12:49:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143087#M28629</guid>
      <dc:creator>Dingdang</dc:creator>
      <dc:date>2013-11-14T12:49:04Z</dc:date>
    </item>
    <item>
      <title>Re: modify all the observations of all the variables in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143088#M28630</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A slight variation on the response supplied by &lt;A __default_attr="9792" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; set have;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; drop i;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; array vars(*) var1 - var3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; do i =1 to dim(vars);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; vars(i)=vars(i) &amp;gt; 0;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; end;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 12:54:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143088#M28630</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2013-11-14T12:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: modify all the observations of all the variables in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143089#M28631</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks, the "drop i" is good.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 15:15:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143089#M28631</guid>
      <dc:creator>Dingdang</dc:creator>
      <dc:date>2013-11-14T15:15:35Z</dc:date>
    </item>
    <item>
      <title>Re: modify all the observations of all the variables in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143090#M28632</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, the drop is good, but, in case it was not noticed, the main change was the absence of any if-then-else statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 17:09:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143090#M28632</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2013-11-14T17:09:06Z</dc:date>
    </item>
    <item>
      <title>Re: modify all the observations of all the variables in a dataset</title>
      <link>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143091#M28633</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Amir,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hehe, thanks for pointing that out. as you correctly noticed, i didnt notice that &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt; learned sth. new again, have to look into that when i finish the current task...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;have a great day.&amp;nbsp; Dingdang &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Nov 2013 17:33:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/modify-all-the-observations-of-all-the-variables-in-a-dataset/m-p/143091#M28633</guid>
      <dc:creator>Dingdang</dc:creator>
      <dc:date>2013-11-14T17:33:59Z</dc:date>
    </item>
  </channel>
</rss>

