<?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: MACRO DO LOOP in SAS Data Management</title>
    <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526368#M16296</link>
    <description>&lt;P&gt;Thank you so much !&lt;/P&gt;</description>
    <pubDate>Fri, 11 Jan 2019 14:04:22 GMT</pubDate>
    <dc:creator>sumsar</dc:creator>
    <dc:date>2019-01-11T14:04:22Z</dc:date>
    <item>
      <title>MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526314#M16282</link>
      <description>&lt;P&gt;Hi everyone, I meet a problem with a do loop.&lt;/P&gt;&lt;P&gt;I try to modify all the format of my dates variables in one time.&lt;/P&gt;&lt;P&gt;I have put all my dates variables in a list and I keep the length of the list too with this instruction :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc contents data=table out=var;run;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select name into :var_list separated by " " from var where format="IS8601DT";&lt;BR /&gt;select count(*) into :nb from var where format="IS8601DT";&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let test = &amp;amp;var_list;&lt;BR /&gt;%let nb = &amp;amp;nb;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And then, I try to modify the format of the dates but when I make it variable by variable it works well , like this :&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data t;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;set table ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,1)=datepart(%scan(&amp;amp;test,1));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,1) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,1) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,2)=datepart(%scan(&amp;amp;test,2));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,2) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,2) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,3)=datepart(%scan(&amp;amp;test,3));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,3) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,3) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,4)=datepart(%scan(&amp;amp;test,4));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,4) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,4) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,5)=datepart(%scan(&amp;amp;test,5));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,5) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,5) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,5)=datepart(%scan(&amp;amp;test,5));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,5) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,5) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,5)=datepart(%scan(&amp;amp;test,5));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,5) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,5) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,6)=datepart(%scan(&amp;amp;test,6));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,6) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,6) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,7)=datepart(%scan(&amp;amp;test,7));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,7) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,7) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,8)=datepart(%scan(&amp;amp;test,8));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,8) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,8) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,9)=datepart(%scan(&amp;amp;test,9));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,9) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,9) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,10)=datepart(%scan(&amp;amp;test,10));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,10) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,10) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,11)=datepart(%scan(&amp;amp;test,11));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,11) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,11) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,12)=datepart(%scan(&amp;amp;test,12));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,12) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,12) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I try to introduce a do loop, it doesn't work :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;data t;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;set table;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;do i=1 TO &amp;amp;nb;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;%scan(&amp;amp;test,i)=datepart(%scan(&amp;amp;test,i));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;format %scan(&amp;amp;test,i) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;informat %scan(&amp;amp;test,i) DDMMYY10.;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;end;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have this error message : "A character operand was found in the %EVAL function or %IF condition where a numeric&lt;BR /&gt;operand is required. The condition was: i"&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Could someone help me please?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm sorry for my low level I start in SAS!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 10:15:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526314#M16282</guid>
      <dc:creator>sumsar</dc:creator>
      <dc:date>2019-01-11T10:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526319#M16283</link>
      <description>&lt;P&gt;do you need ampersands in front of your I's?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t;
set table;
do i=1 TO &amp;amp;nb;
%scan(&amp;amp;test,&amp;amp;i)=datepart(%scan(&amp;amp;test,&amp;amp;i));
format %scan(&amp;amp;test,&amp;amp;i) DDMMYY10.;
informat %scan(&amp;amp;test,&amp;amp;i) DDMMYY10.;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 11:14:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526319#M16283</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-01-11T11:14:53Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526323#M16284</link>
      <description>&lt;P&gt;Hi and thank you for your answer.&lt;/P&gt;&lt;P&gt;Still doesn't work, I have this in my log :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference I not resolved.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric&lt;BR /&gt;operand is required. The condition was: &amp;amp;i&lt;BR /&gt;ERROR: Argument 2 to macro function %SCAN is not a number.&lt;BR /&gt;ERROR 180-322: Statement is not valid or it is used out of proper order.&lt;BR /&gt;ERROR 22-322: Erreur de syntaxe, l'une des valeurs suivantes est attendue : un nom, _ALL_,&lt;BR /&gt;_CHARACTER_, _CHAR_, _NUMERIC_."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 11:17:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526323#M16284</guid>
      <dc:creator>sumsar</dc:creator>
      <dc:date>2019-01-11T11:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526329#M16286</link>
      <description>&lt;P&gt;run this line of code at the start of your program&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;options mprint mlogic symbolgen;&lt;/PRE&gt;
&lt;P&gt;then paste the entire SASLOG into the window that appears when you click on the {i} icon&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, as written, you do not have a "macro do loop" as your title implies, you have a data step do loop which uses a macro function. This is most likely the problem, you have to be very careful mixing and matching macro and data step functionality. I think you probably need a macro do loop (not a data step do loop) and you do need &amp;amp;i instead of i, but the LOG will clear all of this up.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 11:49:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526329#M16286</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-11T11:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526330#M16287</link>
      <description>&lt;P&gt;You need to use a macro do loop:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t;
set table;
%do i=1 %to &amp;amp;nb;
%scan(&amp;amp;test,&amp;amp;i)=datepart(%scan(&amp;amp;test,&amp;amp;i));
format %scan(&amp;amp;test,&amp;amp;i) DDMMYY10.;
informat %scan(&amp;amp;test,&amp;amp;i) DDMMYY10.;
%end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But you can do it directly off sashelp.vtable with call execute():&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
set sashelp.vcolumn (
  where=(libname='WORK' and memname='TABLE' and format = 'IS8601DT')
) end =eof;
if _n_ = 1 then call execute('data t; set table;');
call execute(name !! '=datepart(' !! name !! ');');
call execute('format ' !! name !! ' ddmmyy10.;');
if eof then call execute('run;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Jan 2019 11:55:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526330#M16287</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-11T11:55:14Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526331#M16288</link>
      <description>&lt;P&gt;Also, as far as I can see, macros are completely unnecessary here, and only complicates the whole thing. You could create an array in your data step, and do all of this without macros.&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 11:55:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526331#M16288</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-01-11T11:55:54Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526342#M16291</link>
      <description>&lt;P&gt;It works perfectly!&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 12:50:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526342#M16291</guid>
      <dc:creator>sumsar</dc:creator>
      <dc:date>2019-01-11T12:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526360#M16294</link>
      <description>&lt;P&gt;Just a last question : I have tried to create a macro to do the job on all my files :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sql;&lt;BR /&gt;select distinct memname into :liste separated by " " from sashelp.vcolumn where libname="xxx";&lt;BR /&gt;select count (distinct memname) into :nb from sashelp.vcolumn where libname="xxx";&lt;BR /&gt;quit;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%macro date;&lt;BR /&gt;%do i=1 %to &amp;amp;nb;&lt;BR /&gt;data _null_;&lt;BR /&gt;set sashelp.vcolumn (&lt;BR /&gt;where=(libname="xxx" and memname=%scan(&amp;amp;liste,&amp;amp;i) and format = "IS8601DT19.")&lt;BR /&gt;) end =eof;&lt;BR /&gt;if _n_ = 1 then call execute('data xxx.%scan(&amp;amp;liste,&amp;amp;i); set xxx.%scan(&amp;amp;liste,&amp;amp;i);');&lt;BR /&gt;call execute(name !! '=datepart(' !! name !! ');');&lt;BR /&gt;call execute('format ' !! name !! ' ddmmyy10.;');&lt;BR /&gt;if eof then call execute('run;');&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;run;&lt;BR /&gt;%mend;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But the log says that my files are not present in VCOLUMN, could you help me please?&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 13:42:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526360#M16294</guid>
      <dc:creator>sumsar</dc:creator>
      <dc:date>2019-01-11T13:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526363#M16295</link>
      <description>&lt;P&gt;Given one of your datasets is named YYY, the where condition in the macro would resolve to this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where=(libname="xxx" and memname=YYY and format = "IS8601DT19.")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Since there is no variable YYY in sashelp.vtable, the code will throw an ERROR.&lt;/P&gt;
&lt;P&gt;You have to create a string:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;where=(libname="xxx" and memname="%scan(&amp;amp;liste,&amp;amp;i)" and format = "IS8601DT19.")&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In your further code, take care to use &lt;EM&gt;double&lt;/EM&gt; quotes when macro variables have to be resolved:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if _n_ = 1 then call execute("data xxx.%scan(&amp;amp;liste,&amp;amp;i); set xxx.%scan(&amp;amp;liste,&amp;amp;i);");&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 11 Jan 2019 13:54:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526363#M16295</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-11T13:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526368#M16296</link>
      <description>&lt;P&gt;Thank you so much !&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 14:04:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526368#M16296</guid>
      <dc:creator>sumsar</dc:creator>
      <dc:date>2019-01-11T14:04:22Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526373#M16297</link>
      <description>&lt;P&gt;Don't use macro code when there is regular SAS code that can do the job.&lt;/P&gt;
&lt;P&gt;In this case you want to use an ARRAY.&lt;/P&gt;
&lt;P&gt;So first get your list of variables.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql noprint;
select name
  into :var_list separated by " " 
  from var 
  where format="IS8601DT"
;
%let nb=&amp;amp;sqlobs;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then you can use your list to define the array and sets the new formats.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data t;
  set table ;
  array dates &amp;amp;var_list ;
  do _n_=1 to dim(dates);
     dates(_n_)=datepart(dates(_n_));
  end;
  format &amp;amp;var_list DDMMYY10.;
  informat &amp;amp;var_list DDMMYY10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 14:10:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526373#M16297</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-11T14:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526375#M16298</link>
      <description>&lt;P&gt;Thank you, it works well too.&lt;/P&gt;&lt;P&gt;I have another thing I want to do, I don't know if I can use the same post.&lt;/P&gt;&lt;P&gt;In all my dataset, I have some variables '_decode' which correspond to the format of my variable.&lt;/P&gt;&lt;P&gt;For example, in adataset, I have a variable var1 which takes the values 0 and 1 and just on the right, I have a variable var1_decode which takes the values No and Yes.&lt;/P&gt;&lt;P&gt;I would like to put the values No and Yes in my variable var1 and to delete the variable var1_decode.&lt;/P&gt;&lt;P&gt;And that for all the variables which contain "_decode" in their name.&lt;/P&gt;&lt;P&gt;Do you see a mean to do that ?&lt;/P&gt;&lt;P&gt;Thank you.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jan 2019 14:29:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526375#M16298</guid>
      <dc:creator>sumsar</dc:creator>
      <dc:date>2019-01-11T14:29:07Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526377#M16299</link>
      <description>Make a new post.  Or just the google CNTLIN= option on PROC FORMAT.&lt;BR /&gt;</description>
      <pubDate>Fri, 11 Jan 2019 14:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526377#M16299</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-01-11T14:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: MACRO DO LOOP</title>
      <link>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526866#M16308</link>
      <description>&lt;P&gt;You have to check your where condition, if it &lt;EM&gt;can&lt;/EM&gt; find any matches at all. Does your format on its own return any results? I ask because I can't find documentation for a IS8601DT format.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And no macro is needed, by group processing in the data step will do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let libname=XXX;
%let dateformat=E8601DT19.;

data _null_;
set sashelp.vcolumn (
where=(libname="&amp;amp;libname." and format = "&amp;amp;dateformat.")
);
by memname;
if first.memname then call execute("data &amp;amp;libname.." !! strip(memname) !! "; set &amp;amp;libname.." !! strip(memname) !! ';');
call execute(name !! '=datepart(' !! name !! ');');
call execute('format ' !! name !! ' ddmmyy10.;');
if last.memname then call execute('run;');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Jan 2019 07:53:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Data-Management/MACRO-DO-LOOP/m-p/526866#M16308</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-01-14T07:53:15Z</dc:date>
    </item>
  </channel>
</rss>

