<?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: CALL SYMPUT LOOPING PROBLEM in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386589#M92618</link>
    <description>&lt;DIV class="lia-message-body lia-component-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;i m working on data about loans&lt;/P&gt;&lt;P&gt;for each loan demand i have :&lt;/P&gt;&lt;P&gt;- id_ demand&lt;/P&gt;&lt;P&gt;- date_dem : which is the date when the customer submit his demand ;&lt;/P&gt;&lt;P&gt;- nbimpYYYYMM : which refers to the number of registered umpaids at the end of the month YYYYMM&lt;/P&gt;&lt;P&gt;with YYYYMM going from 201601 to 201706 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What i want to do is to define the variable HR3 where :&lt;/P&gt;&lt;P&gt;HR3 = 1 if the Customer has 3 umpaids or more 3 month after the demand&lt;/P&gt;&lt;P&gt;(which means if nbimp(month demand + 3 months) &amp;gt;=3 ) else 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;date_arr is a global macro variable , it refers to the date when i m running the code (in general is the end of each month )&lt;/P&gt;&lt;P&gt;In my case&amp;nbsp;&lt;/P&gt;&lt;P&gt;date_arr&amp;nbsp; = 31/06/2017 ( i m working on some old data)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code :&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; hr&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;all_products_bis &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
	&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt;  hr&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;all_products_bis &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;  
	date_check &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;intnx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;month&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;date&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;3&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;e&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
	&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;date_check &lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;date_arr&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; do &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
		month_check &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;100&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;year&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;date_risk&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;month&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;date_risk&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token comment"&gt;/* I m looking for how to save this value so that i can access the variable in the if condition below */&lt;/SPAN&gt;
		&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;nbimp&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;month_check&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;3&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; HR_3&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
					&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt;  HR_3&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;0&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;  
			end&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
		end&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i hope you understand the problem&lt;/P&gt;&lt;P&gt;i appreciate your help&lt;/P&gt;&lt;P&gt;thank you &lt;IMG src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" border="0" /&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Wed, 09 Aug 2017 12:25:42 GMT</pubDate>
    <dc:creator>Raitag</dc:creator>
    <dc:date>2017-08-09T12:25:42Z</dc:date>
    <item>
      <title>CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386549#M92598</link>
      <description>&lt;P&gt;Hello all !&lt;/P&gt;&lt;P&gt;I am actually running this code below which is supposed to create the variable "value_copy"&amp;nbsp; as a copy of variable "value"&amp;nbsp; using the call symput rountine ,but it s only keep repeating the last value for all lines .&lt;/P&gt;&lt;P&gt;Any idea of how to fixe that ?&amp;nbsp; Thank you&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test ; 
input value$ @@; 
datalines ; 
a b c d f g h r e s y z
; 
run ; 

proc sort data = test ; 
by value ; 
run ; 
 
data test ; 
	set test ;
		call symput("mv" , value) ;
		value_copy = "&amp;amp;mv" ; 
		
run ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Result" style="width: 188px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/14400i08BDD0E36384706A/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Result" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Result&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 10:47:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386549#M92598</guid>
      <dc:creator>Raitag</dc:creator>
      <dc:date>2017-08-09T10:47:20Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386552#M92599</link>
      <description>&lt;P&gt;The macro variable created by call symput isn't available until the data step ends so if you ran this on a fresh session you would get a note in your log telling you it couldn't be resolved then on the second run it would hold the last value from the first run and so on....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you tell us exactly why you want to do something like this (it isn't clear from the example) we can offer an alternative.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 10:57:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386552#M92599</guid>
      <dc:creator>ChrisBrooks</dc:creator>
      <dc:date>2017-08-09T10:57:13Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386553#M92600</link>
      <description>&lt;P&gt;It's really unclear to me why you have macros here. And, agreeing with &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32246"&gt;@ChrisBrooks&lt;/a&gt;, I don't even understand what you are trying to do or why are you doing this. Please explain the purpose of this program.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What about this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test ; 
	set test ;
	value_copy = value; 
run ;&lt;/PRE&gt;
&lt;P&gt;Or this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;data test ; 
input value$ @@; 
value_copy=value;
datalines ; 
a b c d f g h r e s y z
; 
run ; 
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 10:58:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386553#M92600</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-08-09T10:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386554#M92601</link>
      <description>&lt;P&gt;Macro and datastep are different things. &amp;nbsp;Macro is to create text not to do data processing. &amp;nbsp;From what you posted then:&lt;/P&gt;
&lt;PRE&gt;data test;
  set test;
  value_copy=value;
run;&lt;/PRE&gt;
&lt;P&gt;From the documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#p1vvi5gjow523pn1tmx7cy8ox692.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/lefunctionsref/69762/HTML/default/viewer.htm#p1vvi5gjow523pn1tmx7cy8ox692.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you have a specific need to use symput, please define the scenario.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 10:59:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386554#M92601</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-08-09T10:59:12Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386560#M92604</link>
      <description>&lt;P&gt;Stop abusing the macro processor for something it is not designed for. This can be VERY simply done with data step code.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 11:12:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386560#M92604</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-09T11:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386562#M92605</link>
      <description>&lt;P&gt;Yes i know,&amp;nbsp; i m just trying to give o basic example of my problem&lt;/P&gt;&lt;P&gt;what i want to do is much bigger than that&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 11:15:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386562#M92605</guid>
      <dc:creator>Raitag</dc:creator>
      <dc:date>2017-08-09T11:15:36Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386565#M92606</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132922"&gt;@Raitag&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Yes i know,&amp;nbsp; i m just trying to give o basic example of my problem&lt;/P&gt;
&lt;P&gt;what i want to do is much bigger than that&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It is still a basic abuse of the macro processor. The data step language provides for several mechanisms to conserve values across observations (retain, lag functions, hash objects), which are much better suited for such tasks. The macro processor is designed to create dynamic code, NOT to handle data.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 11:20:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386565#M92606</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-09T11:20:15Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386579#M92612</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132922"&gt;@Raitag&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Yes i know,&amp;nbsp; i m just trying to give o basic example of my problem&lt;/P&gt;
&lt;P&gt;what i want to do is much bigger than that&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;But you still haven't explained to us the problem&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And without that explanation, you're not going to get anywhere in this forum or any other forum.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 11:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386579#M92612</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2017-08-09T11:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386580#M92613</link>
      <description>&lt;P&gt;As part of a bigger problem, perhaps macro language would be appropriate.&amp;nbsp; It's too difficult to tell from this vantage point.&amp;nbsp; At least be open to the possibility that a DATA step might be all you need.&amp;nbsp; Regardless, what you ask for is relatively simple:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data test;&lt;/P&gt;
&lt;P&gt;set test;&lt;/P&gt;
&lt;P&gt;call symput("mv", value);&lt;/P&gt;
&lt;P&gt;value_copy = symget('mv');&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some of the wrinkles:&amp;nbsp; CALL SYMPUT does not remove trailing blanks (but switching to CALL SYMPUTX would).&amp;nbsp; So &amp;amp;MV may contain trailing blanks.&amp;nbsp; And the length of VALUE_COPY is (by default, unless you set the length earlier in the DATA step) 200.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 11:58:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386580#M92613</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-09T11:58:57Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386583#M92615</link>
      <description>&lt;P&gt;You have a basic timing problem. &amp;nbsp;The SAS macro processor resolves the macro code to text and then SAS compiles the data step then it run the data step. &amp;nbsp;So look at this step.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test ; 
  set test ;
  call symput("mv" , value) ;
  value_copy = "&amp;amp;mv" ; 
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So if the value of the macro variable MV is set to z with 7 spaces after it then this is code that SAS will compile and run.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test ; 
  set test ;
  call symput("mv" , value) ;
  value_copy = "z       " ; 
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you really need to retrieve the value of macro variable that might have changed since the data step was compiled then use the SYMGET() function.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test ; 
  set test ;
  call symput("mv" , value) ;
  value_copy = symget("mv");
run ;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Aug 2017 12:11:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386583#M92615</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-08-09T12:11:53Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386587#M92616</link>
      <description>&lt;P&gt;i m working on data about loans&lt;/P&gt;&lt;P&gt;for each loan demand i have :&lt;/P&gt;&lt;P&gt;- id_ demand&lt;/P&gt;&lt;P&gt;- date_dem : which is the date when the customer submit his demand ;&lt;/P&gt;&lt;P&gt;- nbimpYYYYMM : which refers to the number of registered umpaids at the end of the month YYYYMM&lt;/P&gt;&lt;P&gt;with YYYYMM going from 201601 to 201606 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What i want to do is to define the variable HR3 where :&lt;/P&gt;&lt;P&gt;HR3 = 1 if the Customer has 3 umpaids or more 3 month after the demand&lt;/P&gt;&lt;P&gt;(which means if nbimp(month demand + 3 months) &amp;gt;=3 ) else 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;date_arr is a global macro variable , it refers to the date when i m running the code (in general is the end of each month )&lt;/P&gt;&lt;P&gt;In my case&amp;nbsp;&lt;/P&gt;&lt;P&gt;date_arr&amp;nbsp; = 31/06/2017 ( i m working on some old data)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data hr.all_products_bis ; 
	set  hr.all_products_bis ;  
	date_check = intnx(month,&amp;amp;date,3,e); 
	if (date_check &amp;lt;= &amp;amp;date_arr.) then do ; 
		month_check = 100*year(&amp;amp;date_risk)+ month(&amp;amp;date_risk)) ; /* I m looking for how to save this value so that i can access the variable in the if condition below */
		if (nbimp&amp;amp;month_check.&amp;gt;=3 ) then HR_3= 1 ; 
					else  HR_3= 0 ;  
			end; 
		end; 
run ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i hope you understand the problem&lt;/P&gt;&lt;P&gt;i appreciate your help&lt;/P&gt;&lt;P&gt;thank you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 12:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386587#M92616</guid>
      <dc:creator>Raitag</dc:creator>
      <dc:date>2017-08-09T12:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386588#M92617</link>
      <description>&lt;P&gt;sorry&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the YYYYMM go from 201601 to 201706&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 12:24:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386588#M92617</guid>
      <dc:creator>Raitag</dc:creator>
      <dc:date>2017-08-09T12:24:23Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386589#M92618</link>
      <description>&lt;DIV class="lia-message-body lia-component-body"&gt;&lt;DIV class="lia-message-body-content"&gt;&lt;P&gt;i m working on data about loans&lt;/P&gt;&lt;P&gt;for each loan demand i have :&lt;/P&gt;&lt;P&gt;- id_ demand&lt;/P&gt;&lt;P&gt;- date_dem : which is the date when the customer submit his demand ;&lt;/P&gt;&lt;P&gt;- nbimpYYYYMM : which refers to the number of registered umpaids at the end of the month YYYYMM&lt;/P&gt;&lt;P&gt;with YYYYMM going from 201601 to 201706 ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What i want to do is to define the variable HR3 where :&lt;/P&gt;&lt;P&gt;HR3 = 1 if the Customer has 3 umpaids or more 3 month after the demand&lt;/P&gt;&lt;P&gt;(which means if nbimp(month demand + 3 months) &amp;gt;=3 ) else 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;date_arr is a global macro variable , it refers to the date when i m running the code (in general is the end of each month )&lt;/P&gt;&lt;P&gt;In my case&amp;nbsp;&lt;/P&gt;&lt;P&gt;date_arr&amp;nbsp; = 31/06/2017 ( i m working on some old data)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code :&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token procnames"&gt;data&lt;/SPAN&gt; hr&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;all_products_bis &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
	&lt;SPAN class="token keyword"&gt;set&lt;/SPAN&gt;  hr&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;all_products_bis &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;  
	date_check &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;intnx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;month&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;date&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;3&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt;e&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
	&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;date_check &lt;SPAN class="token operator"&gt;&amp;lt;=&lt;/SPAN&gt; &lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;date_arr&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; do &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
		month_check &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;100&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;year&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;date_risk&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;month&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;date_risk&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; &lt;SPAN class="token comment"&gt;/* I m looking for how to save this value so that i can access the variable in the if condition below */&lt;/SPAN&gt;
		&lt;SPAN class="token keyword"&gt;if&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;nbimp&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;month_check&lt;SPAN class="token punctuation"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;gt;=&lt;/SPAN&gt;&lt;SPAN class="token number"&gt;3&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt; &lt;SPAN class="token keyword"&gt;then&lt;/SPAN&gt; HR_3&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;1&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
					&lt;SPAN class="token keyword"&gt;else&lt;/SPAN&gt;  HR_3&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;0&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;  
			end&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
		end&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt; 
&lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt; &lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;i hope you understand the problem&lt;/P&gt;&lt;P&gt;i appreciate your help&lt;/P&gt;&lt;P&gt;thank you &lt;IMG src="https://communities.sas.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" border="0" /&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 09 Aug 2017 12:25:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386589#M92618</guid>
      <dc:creator>Raitag</dc:creator>
      <dc:date>2017-08-09T12:25:42Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386590#M92619</link>
      <description>&lt;P&gt;Declare an array over your nbimpYYMM variables, calculate the index from your month_check, and use that. No macro necessary.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 12:27:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386590#M92619</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-09T12:27:52Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386591#M92620</link>
      <description>&lt;P&gt;ps :&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;month_check &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token number"&gt;100&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;*&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;year&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;date_check&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;+&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;month&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token operator"&gt;&amp;amp;&lt;/SPAN&gt;date_check&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 09 Aug 2017 12:28:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386591#M92620</guid>
      <dc:creator>Raitag</dc:creator>
      <dc:date>2017-08-09T12:28:38Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386593#M92621</link>
      <description>&lt;P&gt;something like&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;array nbimp2016 {*} nbimp201601-nbimp201606;
month_check = month(&amp;amp;date_risk);
if (nbimp2016{month_check} &amp;gt;= 3)
then HR_3 = 1;
else HR_3 = 0;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In the same vein, you could create a two-dimensional array with years and months.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 12:32:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386593#M92621</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-09T12:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386595#M92622</link>
      <description>&lt;P&gt;Your problem does not look like something that needs to use macro code. But your description of your data and the code you posted are at odds. &amp;nbsp;The code seems to be thinking there is a variable with the month in it,&lt;/P&gt;
&lt;PRE&gt;PRODUCT|MONTH|VALUE
101|201606|25
101|201607|35&lt;/PRE&gt;
&lt;P&gt;but the description seemed to say that the month is actually coded into the name of the variable.&lt;/P&gt;
&lt;PRE&gt;PRODUCT|VAL201606|VAL201607
101|25|35&lt;/PRE&gt;
&lt;P&gt;Which format is the data actually in?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 12:33:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386595#M92622</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-08-09T12:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386616#M92633</link>
      <description>the second format&lt;BR /&gt;the nbimpYYYYMM are variables that contains month in their name</description>
      <pubDate>Wed, 09 Aug 2017 13:39:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386616#M92633</guid>
      <dc:creator>Raitag</dc:creator>
      <dc:date>2017-08-09T13:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386622#M92637</link>
      <description />
      <pubDate>Wed, 09 Aug 2017 13:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386622#M92637</guid>
      <dc:creator>Raitag</dc:creator>
      <dc:date>2017-08-09T13:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: CALL SYMPUT LOOPING PROBLEM</title>
      <link>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386631#M92640</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132922"&gt;@Raitag&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Sorry i clicked on the wrong button&lt;/P&gt;
&lt;P&gt;But by defining a two dimensional array i will have all my nbimpYYYYMM s value set to zero&lt;/P&gt;
&lt;P&gt;won't i ?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;A SAS array is just a "grid" that can be put upon existing variables to easily address them. It does not change values of variables per se.&lt;/P&gt;
&lt;P&gt;If you define variables in the array that do not yet exist, then those are set to missing initially.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&lt;/P&gt;
&lt;P&gt;and if you have lots of those nbimp variables, it will make sense to use macro programming to create the array definition.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Aug 2017 13:52:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/CALL-SYMPUT-LOOPING-PROBLEM/m-p/386631#M92640</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-08-09T13:52:36Z</dc:date>
    </item>
  </channel>
</rss>

