<?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 Code not working properly in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Code-not-working-properly/m-p/623985#M183740</link>
    <description>&lt;P&gt;Hi.….when I run the attached code for 200 records it seems to work fine but when I re-run it for 500 records it doesn't run. Any suggestions why this might be occurring. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wan (drop = _:) ;                                                                                                                          
  set wan2 ;  
  	_minym = input (put (start_yrmo, 6.), yymmn6.) ;                                                                                              
  		do _n_ = 1 by 1 until (_minym = input(put(end_yrmo,6.),yymmn6.)) ;                                                                      
    	output ;                                                                                                                                     
    	_minym = intnx ("mon", _minym, 1) ;                                                                                                          
    	start_yrmo = input(put (_minym, yymmn6.),6.);                                                                                             
  end ;                                                                                                                                          
run ;


Log Outputs:

64         
65         data wan (drop = _:) ;
66           set wan2(obs=200) ;
67           	_minym = input (put (start_yrmo, 6.), yymmn6.) ;
68           		do _n_ = 1 by 1 until (_minym = input(put(end_yrmo,6.),yymmn6.)) ;
69             	output ;
70             	_minym = intnx ("mon", _minym, 1) ;
71             	start_yrmo = input(put (_minym, yymmn6.),6.);
72           end ;
73         run ;

NOTE: There were 200 observations read from the data set WORK.WAN2.
NOTE: The data set WORK.WAN has 901 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds

64         
65         data wan (drop = _:) ;
66           set wan2(obs=1000) ;
67           	_minym = input (put (start_yrmo, 6.), yymmn6.) ;
68           		do _n_ = 1 by 1 until (_minym = input(put(end_yrmo,6.),yymmn6.)) ;
69             	output ;
70             	_minym = intnx ("mon", _minym, 1) ;
71             	start_yrmo = input(put (_minym, yymmn6.),6.);
72           end ;
73         run ;

NOTE: Invalid argument to function INPUT at line 71 column 19.
NOTE: The DATA step has been abnormally terminated.
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      2290719 at 70:15   
NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to 
      missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1 at 70:15        120012 at 71:19   
NOTE: There were 459 observations read from the data set WORK.WAN2.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 11 Feb 2020 19:56:01 GMT</pubDate>
    <dc:creator>twildone</dc:creator>
    <dc:date>2020-02-11T19:56:01Z</dc:date>
    <item>
      <title>Code not working properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-not-working-properly/m-p/623985#M183740</link>
      <description>&lt;P&gt;Hi.….when I run the attached code for 200 records it seems to work fine but when I re-run it for 500 records it doesn't run. Any suggestions why this might be occurring. Thanks.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wan (drop = _:) ;                                                                                                                          
  set wan2 ;  
  	_minym = input (put (start_yrmo, 6.), yymmn6.) ;                                                                                              
  		do _n_ = 1 by 1 until (_minym = input(put(end_yrmo,6.),yymmn6.)) ;                                                                      
    	output ;                                                                                                                                     
    	_minym = intnx ("mon", _minym, 1) ;                                                                                                          
    	start_yrmo = input(put (_minym, yymmn6.),6.);                                                                                             
  end ;                                                                                                                                          
run ;


Log Outputs:

64         
65         data wan (drop = _:) ;
66           set wan2(obs=200) ;
67           	_minym = input (put (start_yrmo, 6.), yymmn6.) ;
68           		do _n_ = 1 by 1 until (_minym = input(put(end_yrmo,6.),yymmn6.)) ;
69             	output ;
70             	_minym = intnx ("mon", _minym, 1) ;
71             	start_yrmo = input(put (_minym, yymmn6.),6.);
72           end ;
73         run ;

NOTE: There were 200 observations read from the data set WORK.WAN2.
NOTE: The data set WORK.WAN has 901 observations and 10 variables.
NOTE: DATA statement used (Total process time):
      real time           0.01 seconds
      cpu time            0.00 seconds

64         
65         data wan (drop = _:) ;
66           set wan2(obs=1000) ;
67           	_minym = input (put (start_yrmo, 6.), yymmn6.) ;
68           		do _n_ = 1 by 1 until (_minym = input(put(end_yrmo,6.),yymmn6.)) ;
69             	output ;
70             	_minym = intnx ("mon", _minym, 1) ;
71             	start_yrmo = input(put (_minym, yymmn6.),6.);
72           end ;
73         run ;

NOTE: Invalid argument to function INPUT at line 71 column 19.
NOTE: The DATA step has been abnormally terminated.
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      2290719 at 70:15   
NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to 
      missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      1 at 70:15        120012 at 71:19   
NOTE: There were 459 observations read from the data set WORK.WAN2.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 11 Feb 2020 19:56:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-not-working-properly/m-p/623985#M183740</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2020-02-11T19:56:01Z</dc:date>
    </item>
    <item>
      <title>Re: Code not working properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-not-working-properly/m-p/623989#M183741</link>
      <description>&lt;P&gt;This is a case where you need to look at the data set and see what is in there. Somewhere after row 200, most likely on row 459, you have a value of _minym that cannot be written using informat yymmn6.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 20:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-not-working-properly/m-p/623989#M183741</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-02-11T20:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Code not working properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-not-working-properly/m-p/624001#M183742</link>
      <description>&lt;P&gt;Without knowing teh data this is difficult to pinpoint. But some general remarks are:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I advise against using the name _n_ as a loop variable. This variable is special in that it indicates the number of iterations the datastep has gone through. Usually it is also the sequence number of the record read with the set statement. So grant it its special purpose and leave it alone.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The log suggest that at a certain data row the variable _minym becomes missing, likely because of the value of start_yrmo. I would suggest to run only the first two statements of your datastep to investigate these values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider using put statements in your code&amp;nbsp; for debugging Like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data wan (drop = _:);&lt;BR /&gt;   set wan2;&lt;BR /&gt;   _minym = input (put (start_yrmo, 6.), yymmn6.);&lt;BR /&gt;   &lt;STRONG&gt;if missing(_minym) then put _all_;&lt;/STRONG&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ...&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Te log will show the value of all variables for that record in dataset wan2.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Consider using the datastep debugger. A great tool for investigating these pesky little data related problems and go to the bottom if it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;-- Jan.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 20:18:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-not-working-properly/m-p/624001#M183742</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2020-02-11T20:18:41Z</dc:date>
    </item>
    <item>
      <title>Re: Code not working properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-not-working-properly/m-p/624019#M183751</link>
      <description>&lt;P&gt;Hi Paige...thanks for your help.....the issue was that it is possible to have the same start_yrmo and end_yrmo and it didn't know how to handle it.....Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 21:12:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-not-working-properly/m-p/624019#M183751</guid>
      <dc:creator>twildone</dc:creator>
      <dc:date>2020-02-11T21:12:48Z</dc:date>
    </item>
    <item>
      <title>Re: Code not working properly</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Code-not-working-properly/m-p/624028#M183755</link>
      <description>&lt;P&gt;Likely culprit data values:&lt;/P&gt;
&lt;PRE&gt;data work.problemdata;
   set wan2 (keep= start_yrmo);
   _minym = input (put (start_yrmo, 6.), yymmn6.) ;
   if missing(_minym);
run;&lt;/PRE&gt;
&lt;P&gt;My money is on some "month" values of 00.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Feb 2020 21:26:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Code-not-working-properly/m-p/624028#M183755</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-02-11T21:26:03Z</dc:date>
    </item>
  </channel>
</rss>

