<?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: Error Log Says that there is no if then clause but there is...? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451944#M114024</link>
    <description>&lt;P&gt;Number one, thanks for explicitly stating that all output files must also be named in the data step. I have been learning SAS over the past few months from scratch from the book Learning Sas by Example. While it teaches a lot, it did not explicitly state this. Now that I go through the chapters I see that all output data sets were first named in the data step, but I didn't know that was required until now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, regarding the logs, and {i}, could you please expound on that? What I have done is to copy the logs from SAS University, OpenBox (on Windows). When I do this, it tells me that the HTML is invalid, and removes it, before I can post. I tried to hit CTRL i but that did not do anything. How exactly do I get the information from the log properly transferred onto this board? Tx.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 06 Apr 2018 15:18:46 GMT</pubDate>
    <dc:creator>ManitobaMoose</dc:creator>
    <dc:date>2018-04-06T15:18:46Z</dc:date>
    <item>
      <title>Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451398#M113787</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code:&lt;/P&gt;&lt;P&gt;------------------&lt;/P&gt;&lt;P&gt;/* Chapter 21&lt;BR /&gt;Problem 21.10*/&lt;BR /&gt;Libname Learn'/folders/myfolders/SASData' ;&lt;BR /&gt;&lt;BR /&gt;Data Prob21_10 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;infile '/folders/myfolders/SASData/mixed_recs.txt'&amp;nbsp; pad ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;input @16 Code 2.&amp;nbsp; @ ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;If Code eq 2 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Output = Sales ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;input @1 PartNumber $ 5.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @8 Quantity 3.&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Else if Code ne 2 then&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Output = Inventory ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;input @1&amp;nbsp; Date mmddyy10.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30987"&gt;@11&lt;/a&gt; Amount 5. ;&lt;BR /&gt;run ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------&lt;/P&gt;&lt;P&gt;Here is the Log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;61&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;62 /* Chapter 21&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;63 Problem 21.10*/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;64 Libname Learn'/folders/myfolders/SASData' ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Libref LEARN was successfully assigned as follows:&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Engine: V9&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Physical Name: /folders/myfolders/SASData&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;65&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;66 Data Prob21_10 ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;67 infile '/folders/myfolders/SASData/mixed_recs.txt' pad ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;68 input @16 Code 2. @ ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;69 If Code eq 2 then&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;70 Output = Sales ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;71 input @1 PartNumber $ 5.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72 @8 Quantity 3. ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75 Else if Code ne 2 then&lt;/DIV&gt;&lt;DIV class="sasError"&gt;____&lt;/DIV&gt;&lt;DIV class="sasError"&gt;160&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 160-185: No matching IF-THEN clause.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 Output = Inventory ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77 input @1 Date mmddyy10.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78 &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30987"&gt;@11&lt;/a&gt; Amount 5. ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79 run ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;WARNING: The data set WORK.PROB21_10 may be incomplete. When this step was stopped there were 0 observations and 8 variables.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;WARNING: Data set WORK.PROB21_10 was not replaced because this step was stopped.&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&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;80&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;94&lt;/DIV&gt;&lt;/DIV&gt;&lt;PRE class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 04:31:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451398#M113787</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-04-05T04:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451402#M113789</link>
      <description>&lt;P&gt;You need do blocks.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;  if Code eq 2 then do;
        Output = Sales ;
        input @1 PartNumber $ 5.  @8 Quantity 3.  ;
  end;  
  else do;
        Output = Inventory ;
        input @1 Date mmddyy10. @11 Amount 5. ;
  end;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 05:26:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451402#M113789</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-04-05T05:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451405#M113790</link>
      <description>&lt;P&gt;sas ready sales variable here&lt;/P&gt;&lt;P&gt;what value we get in sales variable&lt;/P&gt;</description>
      <pubDate>Thu, 05 Apr 2018 05:37:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451405#M113790</guid>
      <dc:creator>rvsidhu035</dc:creator>
      <dc:date>2018-04-05T05:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451411#M113791</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data Prob21_10 ;
    infile '/folders/myfolders/SASData/mixed_recs.txt'  pad ;
    input @16 Code 2.  @ ;
    If Code eq 2 then
        Output = Sales ; /* the then branch ends here, and any else must immediately follow it */
        input @1 PartNumber $ 5.
              @8 Quantity 3.  ;
        
    
    Else if Code ne 2 then /* to make this else valid, the previous 2 statements need to be enclosed in a do-end block */
        Output = Inventory ;
        input @1  Date mmddyy10.
              @11 Amount 5. ;
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 05 Apr 2018 06:24:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451411#M113791</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-05T06:24:29Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451749#M113945</link>
      <description>&lt;P&gt;Ok. That makes sense. The do loop needs to be included, and this works. Thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is one more important thing... I need to create separate printouts for Sales and Inventory. In the past , when using an if... then statement, without the do loop, the output created a new data set I could then print. But this does not work when the output=&amp;nbsp;&amp;nbsp;&amp;nbsp; is used withing a do loop, Also, when I try to create the output sets, that is not working either. Finally, the mmddyy10. format does not do anything. The Date in the output window stays in the SAS numerical form, rather than the desired format. This has been frustrating. Any help would be appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is my adjusted code:&lt;/P&gt;&lt;P&gt;--------------------------------&lt;/P&gt;&lt;P&gt;/* Chapter 21&lt;BR /&gt;Problem 21.10*/&lt;/P&gt;&lt;P&gt;Libname Learn'/folders/myfolders/SASData' ;&lt;BR /&gt;&lt;BR /&gt;Data Prob21_10 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;infile '/folders/myfolders/SASData/mixed_recs.txt'&amp;nbsp; pad ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;input @16 Code 2.&amp;nbsp; @ ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;If Code eq 2 then do&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Output = Sales ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;input @1 PartNumber $ 5.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @8 Quantity 3.&amp;nbsp; ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Else if Code ne 2 then do&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;Output = Inventory ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;input @1&amp;nbsp; Date mmddyy10.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30987"&gt;@11&lt;/a&gt; Amount 5. ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;format Data mmddyy10. ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end ;&lt;BR /&gt;run ;&lt;BR /&gt;&lt;BR /&gt;Data Mixed ;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;Set Work.Prob21_10 ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;If Code eq 2 then Output Sales ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;Else if Code ne 2 then Output Inventory ;&lt;BR /&gt;run ;&lt;BR /&gt;&lt;BR /&gt;Title 'Sales' ;&lt;BR /&gt;proc print data=Sales noobs ; &amp;nbsp;&lt;BR /&gt;run ;&lt;BR /&gt;&lt;BR /&gt;Title 'Inventory' ;&lt;BR /&gt;proc print data=Inventory noobs ; &amp;nbsp;&lt;BR /&gt;run ;&lt;/P&gt;&lt;P&gt;-------------------------------------------&lt;/P&gt;&lt;P&gt;Below is the Log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;61&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;62 /* Chapter 21&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;63 Problem 21.10*/&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;64 Libname Learn'/folders/myfolders/SASData' ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Libref LEARN was successfully assigned as follows:&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Engine: V9&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Physical Name: /folders/myfolders/SASData&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;65&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;66 Data Prob21_10 ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;67 infile '/folders/myfolders/SASData/mixed_recs.txt' pad ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;68 input @16 Code 2. @ ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;69 If Code eq 2 then do&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;70 Output = Sales ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;71 input @1 PartNumber $ 5.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;72 @8 Quantity 3. ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;73 end ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;74&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;75&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;76 Else if Code ne 2 then do&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;77 Output = Inventory ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;78 input @1 Date mmddyy10.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;79 &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30987"&gt;@11&lt;/a&gt; Amount 5. ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;80 format Data mmddyy10. ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;81 end ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;82 run ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Variable Sales is uninitialized.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Variable Inventory is uninitialized.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: Variable Data is uninitialized.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The infile '/folders/myfolders/SASData/mixed_recs.txt' is:&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Filename=/folders/myfolders/SASData/mixed_recs.txt,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Owner Name=sasdemo,Group Name=sas,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Access Permission=-rw-rw-r--,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;Last Modified=23Aug2017:10:33:41,&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;File Size (bytes)=106&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: 6 records were read from the infile '/folders/myfolders/SASData/mixed_recs.txt'.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;The minimum record length was 16.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;The maximum record length was 16.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The data set WORK.PROB21_10 has 6 observations and 9 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.01 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;cpu time 0.02 seconds&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;83&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;84 Data Mixed ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;85 Set Work.Prob21_10 ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;86 If Code eq 2 then Output Sales ;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_____&lt;/DIV&gt;&lt;DIV class="sasError"&gt;455&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;87 Else if Code ne 2 then Output Inventory ;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;_________&lt;/DIV&gt;&lt;DIV class="sasError"&gt;455&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR 455-185: Data set was not specified on the DATA statement.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;88 run ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="sasWarning"&gt;WARNING: The data set WORK.MIXED may be incomplete. When this step was stopped there were 0 observations and 9 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.01 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;89&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;90 Title 'Sales' ;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;91 proc print data=Sales noobs ;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: File WORK.SALES.DATA does not exist.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;92 run ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINT 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="sasSource"&gt;93&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;94 Title 'Inventory' ;&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;95 proc print data=Inventory noobs ;&lt;/DIV&gt;&lt;DIV class="sasError"&gt;ERROR: File WORK.INVENTORY.DATA does not exist.&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;96 run ;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/DIV&gt;&lt;DIV class="sasNote"&gt;NOTE: PROCEDURE PRINT 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="sasSource"&gt;97&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;98 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;&lt;/DIV&gt;&lt;DIV class="sasSource"&gt;111&lt;/DIV&gt;&lt;/DIV&gt;&lt;PRE class="sasLog"&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 02:18:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451749#M113945</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-04-06T02:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451756#M113947</link>
      <description>&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;SPAN&gt;See changes in red:&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;data&amp;nbsp; &amp;nbsp;SALES&amp;nbsp; &amp;nbsp; INVENTORY;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;infile '/folders/myfolders/SASData/mixed_recs.txt'&amp;nbsp; pad ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; format &lt;FONT color="#FF0000"&gt;DATE&lt;/FONT&gt;&amp;nbsp;mmddyy10. ;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;input @16 Code 2.&amp;nbsp; @ ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;If Code eq 2 then &lt;FONT color="#FF0000"&gt;do;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;FONT color="#FF0000"&gt;output SALES ;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;input @1 PartNumber $ 5.&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @8 Quantity 3.&amp;nbsp; ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; else if Code ne 2 then &lt;FONT color="#FF0000"&gt;do;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;FONT color="#FF0000"&gt;&amp;nbsp;output&amp;nbsp; INVENTORY ;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;input @1&amp;nbsp; Date mmddyy10.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/30987"&gt;@11&lt;/a&gt;&amp;nbsp;Amount 5. ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; &amp;nbsp; end ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run ;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 03:34:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451756#M113947</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-04-06T03:34:19Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451762#M113950</link>
      <description>&lt;P&gt;Thanks. I tried that. Here are the results I am getting: Everything is in the right place, but both have a title of inventory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="systitleandfootercontainer"&gt;&lt;P&gt;&lt;SPAN class="c systemtitle"&gt;Inventory&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;Code Output Sales PartNumber Quantity Inventory Date Amount&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;10/21/2005&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;11/15/2005&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;A1368&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;B1111&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;01/03/2005&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;A8877&lt;/TD&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;HR /&gt;&lt;DIV class="systitleandfootercontainer"&gt;&lt;P&gt;&lt;SPAN class="c systemtitle"&gt;Inventory&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;Code Output Sales PartNumber Quantity Inventory Date Amount&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;10/21/2005&lt;/TD&gt;&lt;TD&gt;100&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;11/15/2005&lt;/TD&gt;&lt;TD&gt;200&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;A1368&lt;/TD&gt;&lt;TD&gt;250&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;B1111&lt;/TD&gt;&lt;TD&gt;300&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;01/03/2005&lt;/TD&gt;&lt;TD&gt;5000&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;A8877&lt;/TD&gt;&lt;TD&gt;19&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;TD&gt;.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Fri, 06 Apr 2018 04:53:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451762#M113950</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-04-06T04:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451763#M113951</link>
      <description>&lt;P&gt;look at the table called SALES&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 04:55:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451763#M113951</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-04-06T04:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451764#M113952</link>
      <description>&lt;P&gt;Thanks. I am not sure why I did not see the Sales table before, now when I retyped the code I see it. Anyway, it works. I'm getting tired (it's late here). Thanks for your help!.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 05:02:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451764#M113952</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-04-06T05:02:32Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451772#M113957</link>
      <description>&lt;P&gt;a) Please, and I mean &lt;FONT size="5"&gt;&lt;U&gt;&lt;EM&gt;&lt;STRONG&gt;PLEASE!&lt;/STRONG&gt;&lt;/EM&gt;&lt;/U&gt;&lt;FONT size="2"&gt;, start posting logs with the {i} button, so that the text formatting of logs is preserved.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;FONT size="2"&gt;b) The ERROR message&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;PRE&gt;ERROR 455-185: Data set was not specified on the DATA statement.&lt;/PRE&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;FONT size="2"&gt;can't be made any more descriptive. All datasets that are used in an output statement &lt;EM&gt;must&lt;/EM&gt; also appear in the data statement itself.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 06:00:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451772#M113957</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-06T06:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451944#M114024</link>
      <description>&lt;P&gt;Number one, thanks for explicitly stating that all output files must also be named in the data step. I have been learning SAS over the past few months from scratch from the book Learning Sas by Example. While it teaches a lot, it did not explicitly state this. Now that I go through the chapters I see that all output data sets were first named in the data step, but I didn't know that was required until now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Second, regarding the logs, and {i}, could you please expound on that? What I have done is to copy the logs from SAS University, OpenBox (on Windows). When I do this, it tells me that the HTML is invalid, and removes it, before I can post. I tried to hit CTRL i but that did not do anything. How exactly do I get the information from the log properly transferred onto this board? Tx.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV class="sasSource"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Apr 2018 15:18:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451944#M114024</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-04-06T15:18:46Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451959#M114032</link>
      <description>&lt;P&gt;See the instructions here:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/Getting-Started/How-to-add-SAS-syntax-to-your-post/ta-p/224394" target="_blank"&gt;https://communities.sas.com/t5/Getting-Started/How-to-add-SAS-syntax-to-your-post/ta-p/224394&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;The {I} button is right left to the "little running man" button for posting code.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 15:45:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451959#M114032</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-06T15:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451961#M114033</link>
      <description>&lt;PRE&gt;Great. Thanks for the info on {i}. Below is just a test to make sure this is done correctly. 

 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 61         
 62         /* Chapter 21
 63         Problem 21.10*/
 64         Libname Learn'/folders/myfolders/SASData' ;
 NOTE: Libref LEARN was successfully assigned as follows: 
       Engine:        V9 
       Physical Name: /folders/myfolders/SASData
 65         
 66         Data Sales Inventory ;
 67         infile '/folders/myfolders/SASData/mixed_recs.txt'  pad ;
 68         input @16 Code 2.  @ ;
 69         If Code eq 2 then do ;
 70         Output = Sales ;
 71         input @1 PartNumber $ 5.
 72               @8 Quantity 3.  ;
 73         end ;
 74         
 75         
 76         Else if Code ne 2 then do ;
 77         Output = Inventory ;
 78         input @1  Date mmddyy10.
 79               @11 Amount 5. ;
 80         format Date mmddyy10. ;
 81         end ;
 82         run ;
 
 NOTE: Variable Sales is uninitialized.
 NOTE: Variable Inventory is uninitialized.
 NOTE: The infile '/folders/myfolders/SASData/mixed_recs.txt' is:
       Filename=/folders/myfolders/SASData/mixed_recs.txt,
       Owner Name=sasdemo,Group Name=sas,
       Access Permission=-rw-rw-r--,
       Last Modified=23Aug2017:10:33:41,
       File Size (bytes)=106
 
 NOTE: 6 records were read from the infile '/folders/myfolders/SASData/mixed_recs.txt'.
       The minimum record length was 16.
       The maximum record length was 16.
 NOTE: The data set WORK.SALES has 6 observations and 8 variables.
 NOTE: The data set WORK.INVENTORY has 6 observations and 8 variables.
 NOTE: DATA statement used (Total process time):
       real time           0.03 seconds
       cpu time            0.01 seconds
       
 
 83         
 84         
 85         
 86         Title 'Sales' ;
 87         proc print data=Sales noobs ;
 88         run ;
 
 NOTE: There were 6 observations read from the data set WORK.SALES.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.10 seconds
       cpu time            0.09 seconds
       
 
 89         
 90         Title 'Inventory' ;
 91         proc print data=Inventory noobs ;
 92         run ;
 
 NOTE: There were 6 observations read from the data set WORK.INVENTORY.
 NOTE: PROCEDURE PRINT used (Total process time):
       real time           0.07 seconds
       cpu time            0.07 seconds
       &lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Apr 2018 15:58:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451961#M114033</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-04-06T15:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451982#M114037</link>
      <description>&lt;PRE&gt;One last thing on this, and I'm done...


Ok, now I want to get rid of the columns that do not pertain to inventory or sales. I have tried to use drop but it gets rid of all the data.


Below is my code:

---------------------------

/* Chapter 21
Problem 21.10*/
Libname Learn'/folders/myfolders/SASData' ;

Data Sales Inventory ;
    infile '/folders/myfolders/SASData/mixed_recs.txt'  pad ;
    Input @16 Code 2. @ ;
    If Code eq 1 then do ;
        Out = Sales ;
        input @1 Date mmddyy10.
              @11 Amount 5.  ;
        format Date mmddyy10. ;  
    Drop Out ;
    end ;
        
    
    Else if Code ne 1 then do ;
        Out = Inventory ;
        input @1 PartNumber $ 8.
              @9 Quantity 3. ;
    Drop  Out ;     
    end ;
run ;



Title 'Sales' ;
proc print data=Sales noobs ;  
run ;

Title 'Inventory' ;
proc print data=Inventory noobs ;   
run ;

------------------------------------------



Below are the Results:



Sales
Code 	Sales 	Date 	Amount 	Inventory 	PartNumber 	Quantity
1 	. 	10/21/2005 	100 	. 	  	.
1 	. 	11/15/2005 	200 	. 	  	.
2 	. 	. 	. 	. 	A13688 2 	50
2 	. 	. 	. 	. 	B11112 3 	0
1 	. 	01/03/2005 	5000 	. 	  	.
2 	. 	. 	. 	. 	A88778 1 	9

Inventory
Code 	Sales 	Date 	Amount 	Inventory 	PartNumber 	Quantity
1 	. 	10/21/2005 	100 	. 	  	.
1 	. 	11/15/2005 	200 	. 	  	.
2 	. 	. 	. 	. 	A13688 2 	50
2 	. 	. 	. 	. 	B11112 3 	0
1 	. 	01/03/2005 	5000 	. 	  	.
2 	. 	. 	. 	. 	A88778 1 	9

I want to get rid of the Inventory and Sales columns altogether, and get rid of the Partnumber and Quantity columns for Sales, while getting rid of the Date and Amount Column for the inventory listing. 

This one problem has taken a lot of time, much much more than most. Hopefully what is learned from this will help a lot in the future. Tx!&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Apr 2018 16:58:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/451982#M114037</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-04-06T16:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/452005#M114039</link>
      <description>&lt;P&gt;Use selective dataset options, not a global drop statement, and drop/keep the correct variables:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data
  Sales (keep=Code Date Amount)
  Inventory (keep=Code PartNumber Quantity)
;
    format Date mmddyy10.;  
    infile '/folders/myfolders/SASData/mixed_recs.txt' pad;
    Input @16 Code 2. @;
    If Code eq 1 then do;
        input
            @1 Date mmddyy10.
            @11 Amount 5.
        ;
        output Sales;
    end;        
    
    Else do; /* no if-then needed here with the condition you used */
        input
            @1 PartNumber $ 8.
            @9 Quantity 3.
        ;
        output Inventory;     
    end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You might also consider to not keep Code, as it is redundant in each dataset&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 17:45:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/452005#M114039</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-06T17:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/452036#M114043</link>
      <description>&lt;PRE&gt;Ok. I decided to use proc report also to review that. Everything is great, but to be nitpicky, I still have missing data (.) for the data points for Partnumber and Quantity (in Sales) and for Date and Amount (in Inventory). This is simply because, of course, that data did not apply to each respective category. To make the report look nice, it would be best to remove the mssing rows. If it can be done, great, if not, I have learned a lot from this example already., Thanks. 

Here is my code:
-------------------------
/* Chapter 21
Problem 21.10*/
Libname Learn'/folders/myfolders/SASData' ; 

Data Sales(keep = Date Amount) Inventory(keep = Partnumber Quantity) ; 
	infile '/folders/myfolders/SASData/mixed_recs.txt'  pad ; 
	Input @16 Code 2. @ ;
	If Code eq 1 then do ; 
		Out = Sales ;
		input @1 Date mmddyy10. 
		      @12 Amount 4.  ; 
		format Date mmddyy10. ;   
	end ; 
		
	
	Else if Code ne 1 then do ;
		Out = Inventory ;
		input @1 PartNumber $ 6.
		      @8 Quantity 3. ; 
	end ; 
run ; 



Title 'Sales' ; 
proc report data=Sales ;
	column Date Amount ; 
	define Date / display "Date" width=5 ; 
	define Amount / display "Amount" width=5 ; 
run ; 

Title 'Inventory' ; 
proc report data=inventory ;  
	column Partnumber Quantity ; 
	define Partnumber / display "Part Number" width=5 ; 
	define Quantity   / display "Quantity" width = 5 ; 
run ;
--------------------

Here are the results



Sales
Date 	Amount
10/21/2005 	100
11/15/2005 	200
. 	.
. 	.
01/03/2005 	5000
. 	.

Inventory
Part Number 	Quantity
  	.
  	.
A13688 	250
B11112 	300
  	.
A88778 	19&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Apr 2018 18:19:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/452036#M114043</guid>
      <dc:creator>ManitobaMoose</dc:creator>
      <dc:date>2018-04-06T18:19:37Z</dc:date>
    </item>
    <item>
      <title>Re: Error Log Says that there is no if then clause but there is...?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/452418#M114184</link>
      <description>&lt;P&gt;Read my post again, thoroughly. In particular note how output is directed to datasets. With your data step, all records are written to both datasets, and so you get missing values in half of them, when variables are not read by an input statement.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 07:01:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Error-Log-Says-that-there-is-no-if-then-clause-but-there-is/m-p/452418#M114184</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-04-09T07:01:01Z</dc:date>
    </item>
  </channel>
</rss>

