<?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 unable to understand output values of variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/unable-to-understand-output-values-of-variables/m-p/194283#M266346</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear SAS users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help me understand output of below program?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.passengers1;&lt;/P&gt;&lt;P&gt; if origpassengers = . then&amp;nbsp; origpassengers =100;&lt;/P&gt;&lt;P&gt;transpassengers = 100;&lt;/P&gt;&lt;P&gt;origpassengers =&amp;nbsp; totlapassengers = sum( origpassengers, transpassengers) + 0 ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data = work.passengers1;&lt;/P&gt;&lt;P&gt;title 'check-1';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;output is:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;origpassengers &lt;/SPAN&gt;=0&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;transpassengers &lt;/SPAN&gt; =100&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;totlapassengers &lt;/SPAN&gt;= .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i understand is that when pdv initialize all variables to missing, then we get first condition tset to true, hence origpassenger =100, then transpas is set to 100, but then how come value of totalpass is coming out to be missing (.) and why origpass has been set to 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate your help as always &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;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 02 Jul 2015 11:01:49 GMT</pubDate>
    <dc:creator>Darpnew</dc:creator>
    <dc:date>2015-07-02T11:01:49Z</dc:date>
    <item>
      <title>unable to understand output values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unable-to-understand-output-values-of-variables/m-p/194283#M266346</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear SAS users,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help me understand output of below program?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data work.passengers1;&lt;/P&gt;&lt;P&gt; if origpassengers = . then&amp;nbsp; origpassengers =100;&lt;/P&gt;&lt;P&gt;transpassengers = 100;&lt;/P&gt;&lt;P&gt;origpassengers =&amp;nbsp; totlapassengers = sum( origpassengers, transpassengers) + 0 ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print data = work.passengers1;&lt;/P&gt;&lt;P&gt;title 'check-1';&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;output is:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;origpassengers &lt;/SPAN&gt;=0&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;transpassengers &lt;/SPAN&gt; =100&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333330154419px;"&gt;totlapassengers &lt;/SPAN&gt;= .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i understand is that when pdv initialize all variables to missing, then we get first condition tset to true, hence origpassenger =100, then transpas is set to 100, but then how come value of totalpass is coming out to be missing (.) and why origpass has been set to 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate your help as always &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;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2015 11:01:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unable-to-understand-output-values-of-variables/m-p/194283#M266346</guid>
      <dc:creator>Darpnew</dc:creator>
      <dc:date>2015-07-02T11:01:49Z</dc:date>
    </item>
    <item>
      <title>Re: unable to understand output values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unable-to-understand-output-values-of-variables/m-p/194284#M266347</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;again, i just realised that totalpass value should also have been 200 instead of 100. Please explain with bit detail.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2015 11:08:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unable-to-understand-output-values-of-variables/m-p/194284#M266347</guid>
      <dc:creator>Darpnew</dc:creator>
      <dc:date>2015-07-02T11:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: unable to understand output values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unable-to-understand-output-values-of-variables/m-p/194285#M266348</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't understand what you are trying to do here but this is where your problem is:&lt;/P&gt;&lt;P&gt;origpassengers =&amp;nbsp; totlapassengers = sum( origpassengers, transpassengers) + 0 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you give an example of data and your desired solution I can help more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data step1;&lt;/P&gt;&lt;P&gt;infile cards;&lt;/P&gt;&lt;P&gt;input orig ;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;500&lt;/P&gt;&lt;P&gt;2&lt;/P&gt;&lt;P&gt;160&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data passengers1;&lt;/P&gt;&lt;P&gt;set step1;&lt;/P&gt;&lt;P&gt;if orig = . then&amp;nbsp; orig =100;&lt;/P&gt;&lt;P&gt;trans = 100;&lt;/P&gt;&lt;P&gt;total = sum( orig, trans);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are adding the original in hopes to sum that's different, let me if this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data passengers2;&lt;/P&gt;&lt;P&gt;set step1;&lt;/P&gt;&lt;P&gt;if orig = . then&amp;nbsp; orig =100;&lt;/P&gt;&lt;P&gt;trans = 100;&lt;/P&gt;&lt;P&gt;total = sum(orig,trans);&lt;/P&gt;&lt;P&gt;sum + total;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2015 11:46:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unable-to-understand-output-values-of-variables/m-p/194285#M266348</guid>
      <dc:creator>Steelers_In_DC</dc:creator>
      <dc:date>2015-07-02T11:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: unable to understand output values of variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/unable-to-understand-output-values-of-variables/m-p/194286#M266349</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is a problem i came through while preparing for base sas certification, so I am not bringing this problem from any practicle reference / problem. But, I concede that there is some important concept which I am missing and I need to understand that.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 02 Jul 2015 13:53:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/unable-to-understand-output-values-of-variables/m-p/194286#M266349</guid>
      <dc:creator>Darpnew</dc:creator>
      <dc:date>2015-07-02T13:53:07Z</dc:date>
    </item>
  </channel>
</rss>

