<?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 Better understanding of PUTLOG &amp;amp; PUT CONDITIONAL PROCESSING in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Better-understanding-of-PUTLOG-amp-PUT-CONDITIONAL-PROCESSING/m-p/686404#M24425</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Concerning the PUTLOG I understand that it is used to write to the LOG but to help identify errors. &lt;U&gt;But how would you use _N_ or _ERROR_?&lt;/U&gt;&lt;/P&gt;&lt;P&gt;_N_&amp;nbsp; counts the number of iteration&lt;/P&gt;&lt;P&gt;_ERROR_&amp;nbsp; displays 1 for error occurs&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Concerning the PUT conditional processing. I don't completely understand the purpose of using PUT statement. I have a example below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.test;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set cert.loan01;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if code='1' then type='variable'; /*#1*/&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if code='2' then type='fixed';&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else type='unknown';&lt;BR /&gt;if type='unknown' then put 'random items in red ';&amp;nbsp;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the code is runs it will display in the LOG screen "random items in red". But what is the purpose of displaying the multiple lines and providing the number of observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;BR /&gt;NOTE: There were 9 observations read from the data set&lt;BR /&gt;CERT.LOAN.&lt;BR /&gt;NOTE: The data set WORK.LOAN01 has 9 observations and 6&lt;BR /&gt;variables.&lt;/P&gt;</description>
    <pubDate>Thu, 24 Sep 2020 15:30:35 GMT</pubDate>
    <dc:creator>armoore</dc:creator>
    <dc:date>2020-09-24T15:30:35Z</dc:date>
    <item>
      <title>Better understanding of PUTLOG &amp; PUT CONDITIONAL PROCESSING</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Better-understanding-of-PUTLOG-amp-PUT-CONDITIONAL-PROCESSING/m-p/686404#M24425</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Concerning the PUTLOG I understand that it is used to write to the LOG but to help identify errors. &lt;U&gt;But how would you use _N_ or _ERROR_?&lt;/U&gt;&lt;/P&gt;&lt;P&gt;_N_&amp;nbsp; counts the number of iteration&lt;/P&gt;&lt;P&gt;_ERROR_&amp;nbsp; displays 1 for error occurs&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Concerning the PUT conditional processing. I don't completely understand the purpose of using PUT statement. I have a example below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data work.test;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;set cert.loan01;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if code='1' then type='variable'; /*#1*/&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else if code='2' then type='fixed';&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else type='unknown';&lt;BR /&gt;if type='unknown' then put 'random items in red ';&amp;nbsp;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the code is runs it will display in the LOG screen "random items in red". But what is the purpose of displaying the multiple lines and providing the number of observations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;/P&gt;&lt;P&gt;random items in red&lt;BR /&gt;NOTE: There were 9 observations read from the data set&lt;BR /&gt;CERT.LOAN.&lt;BR /&gt;NOTE: The data set WORK.LOAN01 has 9 observations and 6&lt;BR /&gt;variables.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 15:30:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Better-understanding-of-PUTLOG-amp-PUT-CONDITIONAL-PROCESSING/m-p/686404#M24425</guid>
      <dc:creator>armoore</dc:creator>
      <dc:date>2020-09-24T15:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: Better understanding of PUTLOG &amp; PUT CONDITIONAL PROCESSING</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Better-understanding-of-PUTLOG-amp-PUT-CONDITIONAL-PROCESSING/m-p/686464#M24432</link>
      <description>&lt;P&gt;Hi:&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Both PUT and PUTLOG are capable of writing to the SAS log. However PUTLOG will &lt;STRONG&gt;&lt;U&gt;ONLY&lt;/U&gt;&lt;/STRONG&gt; write to the SAS log. PUT as a statement can also be used to write to an external file. In the program, as shown below the PUT statement is writing to the log and to an external file:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Cynthia_sas_0-1600971617184.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/49758i907FE6412AD8632C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Cynthia_sas_0-1600971617184.png" alt="Cynthia_sas_0-1600971617184.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note that the yellow highlighted statement (PUTLOG) and the cyan highlighted statement (PUT) both write to the SAS log. using NOTE: at the beginning of the text string caused color coding to be implemented in the log.&amp;nbsp; However, PUT, when used with a FILE statement changes the behavior of where the PUT statement writes. The PUT statement that immediately follows a FILE statement writes to the file specified, in this case, c:\temp\writeclass.txt. There are many different formatting things I could have done but did not do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have used _N_ and _ERROR_ in PUTLOG statements for debugging. Typically it has happened when I've had a big program (over 500 lines of code) and there was some logic problem that I needed to trace. The place where I used _N_ and _ERROR_ was to dump an entire observation when I encounted an error to see whether there was bad data or whether my program had failed to account for the condition that broke the logic. In the Programming 2 class, we have some examples of using PUTLOG to help you debug a program. If you are studying for certification and using one of the Prep Guides, it may be useful to review the PUTLOG section in Programming 2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Maybe others will have some examples of when they've used _N_ and _ERROR_ and PUTLOG for debugging.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Cynthia&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 18:28:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Better-understanding-of-PUTLOG-amp-PUT-CONDITIONAL-PROCESSING/m-p/686464#M24432</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2020-09-24T18:28:34Z</dc:date>
    </item>
  </channel>
</rss>

