<?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 Macro help for data step automation in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Macro-help-for-data-step-automation/m-p/133183#M27093</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can someone please help me create an automation/macro for this data step. Right now, I get data on a daily basis and I have to create fileid every day which is a pain when I get more than 1000 file ids. Is there a way it can automatically pick the total file ids from my stats data to create the %fileid(num=n) datasets, inN datasets and newN datasets. And is there a way to reduce the macro to few lines without filling the editor window. Please help.&lt;/P&gt;&lt;P&gt;For more information, this is what I am trying to achieve&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/message/185370#185370"&gt;https://communities.sas.com/message/185370#185370&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Many thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Comparing for unique VehicleIds*/ /*Update everyday*/&lt;/P&gt;&lt;P&gt;%macro fileid (num=);&lt;/P&gt;&lt;P&gt;proc sort data=tripstats;&lt;/P&gt;&lt;P&gt;by fileid vehicleid;&lt;/P&gt;&lt;P&gt;data fileid&amp;amp;num;&lt;/P&gt;&lt;P&gt;set stats;&lt;/P&gt;&lt;P&gt;by fileid vehicleid;&lt;/P&gt;&lt;P&gt;if fileid = &amp;amp;num;&lt;/P&gt;&lt;P&gt;if first.vehicleid then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=fileid&amp;amp;num;&lt;/P&gt;&lt;P&gt;by vehicleid;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend fileid;&lt;/P&gt;&lt;P&gt;%fileid (num=6);%fileid (num=7);%fileid (num=8);%fileid (num=9);%fileid (num=10);%fileid (num=11);%fileid (num=12);%fileid (num=13);&lt;/P&gt;&lt;P&gt;%fileid (num=14);%fileid (num=15);%fileid (num=16);%fileid (num=17);%fileid (num=18);%fileid (num=19);%fileid (num=20);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=stats;&lt;/P&gt;&lt;P&gt;by fileid vehicleid;&lt;/P&gt;&lt;P&gt;data fileid5;&lt;/P&gt;&lt;P&gt;set stats;&lt;/P&gt;&lt;P&gt;by fileid vehicleid;&lt;/P&gt;&lt;P&gt;if fileid=5;&lt;/P&gt;&lt;P&gt;if last.vehicleid then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=fileid5;&lt;/P&gt;&lt;P&gt;by vehicleid;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*New vehicles in each fileid*/&lt;/P&gt;&lt;P&gt;title1 "Unique vehicles in each fileid";&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; merge fileid5 (in=in5 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileid6 (in=in6 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileid7 (in=in7 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileid8 (in=in8 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileid9 (in=in9 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileid10(in=in10 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid11(in=in11 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid12(in=in12 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid13(in=in13 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid14(in=in14 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid15(in=in15 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid16(in=in16 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid17(in=in17 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid18(in=in18 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid19(in=in19 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid20(in=in20 keep=vehicleid)&lt;/P&gt;&lt;P&gt;...................................&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end=eof&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by vehicleid;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.vehicleid;&lt;/P&gt;&lt;P&gt;&amp;nbsp; new6 + (in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new7 + (in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new8 + (in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new9 + (in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new10+ (in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new11+ (in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new12+ (in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new13+ (in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new14+ (in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new15+ (in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new16+ (in16 and ^in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new17+ (in17 and ^in16 and ^in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new18+ (in18 and ^in17 and ^in16 and ^in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new19+ (in19 and ^in18 and ^in17 and ^in16 and ^in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new20+ (in20 and ^in19 and ^in18 and ^in17 and ^in16 and ^in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; .....................&lt;/P&gt;&lt;P&gt;if eof;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put (new6-new108) (=/);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Nov 2013 21:30:39 GMT</pubDate>
    <dc:creator>saslove</dc:creator>
    <dc:date>2013-11-05T21:30:39Z</dc:date>
    <item>
      <title>Macro help for data step automation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-help-for-data-step-automation/m-p/133183#M27093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can someone please help me create an automation/macro for this data step. Right now, I get data on a daily basis and I have to create fileid every day which is a pain when I get more than 1000 file ids. Is there a way it can automatically pick the total file ids from my stats data to create the %fileid(num=n) datasets, inN datasets and newN datasets. And is there a way to reduce the macro to few lines without filling the editor window. Please help.&lt;/P&gt;&lt;P&gt;For more information, this is what I am trying to achieve&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/message/185370#185370"&gt;https://communities.sas.com/message/185370#185370&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Many thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*Comparing for unique VehicleIds*/ /*Update everyday*/&lt;/P&gt;&lt;P&gt;%macro fileid (num=);&lt;/P&gt;&lt;P&gt;proc sort data=tripstats;&lt;/P&gt;&lt;P&gt;by fileid vehicleid;&lt;/P&gt;&lt;P&gt;data fileid&amp;amp;num;&lt;/P&gt;&lt;P&gt;set stats;&lt;/P&gt;&lt;P&gt;by fileid vehicleid;&lt;/P&gt;&lt;P&gt;if fileid = &amp;amp;num;&lt;/P&gt;&lt;P&gt;if first.vehicleid then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=fileid&amp;amp;num;&lt;/P&gt;&lt;P&gt;by vehicleid;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;%mend fileid;&lt;/P&gt;&lt;P&gt;%fileid (num=6);%fileid (num=7);%fileid (num=8);%fileid (num=9);%fileid (num=10);%fileid (num=11);%fileid (num=12);%fileid (num=13);&lt;/P&gt;&lt;P&gt;%fileid (num=14);%fileid (num=15);%fileid (num=16);%fileid (num=17);%fileid (num=18);%fileid (num=19);%fileid (num=20);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=stats;&lt;/P&gt;&lt;P&gt;by fileid vehicleid;&lt;/P&gt;&lt;P&gt;data fileid5;&lt;/P&gt;&lt;P&gt;set stats;&lt;/P&gt;&lt;P&gt;by fileid vehicleid;&lt;/P&gt;&lt;P&gt;if fileid=5;&lt;/P&gt;&lt;P&gt;if last.vehicleid then output;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;proc sort data=fileid5;&lt;/P&gt;&lt;P&gt;by vehicleid;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*New vehicles in each fileid*/&lt;/P&gt;&lt;P&gt;title1 "Unique vehicles in each fileid";&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; merge fileid5 (in=in5 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileid6 (in=in6 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileid7 (in=in7 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileid8 (in=in8 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileid9 (in=in9 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fileid10(in=in10 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid11(in=in11 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid12(in=in12 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid13(in=in13 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid14(in=in14 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid15(in=in15 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid16(in=in16 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid17(in=in17 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid18(in=in18 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid19(in=in19 keep=vehicleid)&lt;/P&gt;&lt;P&gt;&amp;nbsp; fileid20(in=in20 keep=vehicleid)&lt;/P&gt;&lt;P&gt;...................................&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end=eof&lt;/P&gt;&lt;P&gt;&amp;nbsp; ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by vehicleid;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if first.vehicleid;&lt;/P&gt;&lt;P&gt;&amp;nbsp; new6 + (in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new7 + (in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new8 + (in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new9 + (in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new10+ (in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new11+ (in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new12+ (in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new13+ (in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new14+ (in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new15+ (in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new16+ (in16 and ^in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new17+ (in17 and ^in16 and ^in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new18+ (in18 and ^in17 and ^in16 and ^in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new19+ (in19 and ^in18 and ^in17 and ^in16 and ^in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; new20+ (in20 and ^in19 and ^in18 and ^in17 and ^in16 and ^in15 and ^in14 and ^in13 and ^in12 and ^in11 and ^in10 and ^in9 and ^in8 and ^in7 and ^in6 and ^in5);&lt;/P&gt;&lt;P&gt;&amp;nbsp; .....................&lt;/P&gt;&lt;P&gt;if eof;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put (new6-new108) (=/);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Nov 2013 21:30:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-help-for-data-step-automation/m-p/133183#M27093</guid>
      <dc:creator>saslove</dc:creator>
      <dc:date>2013-11-05T21:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help for data step automation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-help-for-data-step-automation/m-p/133184#M27094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have a look at the UPDATE statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;xxxxxxxxxxxx&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Peter Crawford&#xD;
&#xD;
Strike that idea.&amp;nbsp; Only vehicleID and a descriptive var are needed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Nov 2013 22:47:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-help-for-data-step-automation/m-p/133184#M27094</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-11-06T22:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help for data step automation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-help-for-data-step-automation/m-p/133185#M27095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It might be more easily solved with interleaved SET using INDSNAME= to identify from which table a VehicleID first appears.&lt;/P&gt;&lt;P&gt;Then it becomes important to order the tables appearing on the SET into proper chronology.&lt;/P&gt;&lt;P&gt;A further enhancement might retain the table of vehicleID and first-appearance-ref. Then you only need insert VehicleID (with a new ref) which are NOT already in the table - probably SQL could do the whole thing in a couple of queries.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Nov 2013 15:32:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-help-for-data-step-automation/m-p/133185#M27095</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-11-07T15:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Macro help for data step automation</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Macro-help-for-data-step-automation/m-p/133186#M27096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is some code to create a register of VEHICLEID along with the smallest ref number in which the vehicleID is found.&lt;/P&gt;&lt;P&gt;(a natural extra I presumed to add was the date on which the addition to the register occurs)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; LATEST_id( &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;label&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;= &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;&lt;SPAN&gt;'see &lt;/SPAN&gt;&lt;A class="" href="https://communities.sas.com/message/187144#187144"&gt;https://communities.sas.com/message/187144#187144&lt;/A&gt;&lt;SPAN&gt; '&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; index=( vehicleID/unique refn) )&amp;nbsp; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; vehicleID $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; LATEST REFn &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;8&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;ATTRIB&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; LATEST &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;FORMAT&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;= &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;DATE9.&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;INFORMAT&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;= &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;DATE.&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;STOP&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;CALL&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; MISSING( OF _ALL_ ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;RUN&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;and here is a macro that uses SQL to add new vehicleID values to the register&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;%macro&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; pasttimes( fromf=, tof= ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%local&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; f ; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%do&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; f= &amp;amp;fromf &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%to&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;tof ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;data&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; fileid&amp;amp;F ; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;* simulate data collection ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;length&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; vehicleID $&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;12&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;retain&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; a1-a100 &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;8&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _n_ = &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;to&lt;/SPAN&gt; &lt;STRONG style="color: teal; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;1000&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; vehicleID = put( _n_, &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;z12.&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; _n_ + int( ranuni( &amp;amp;f) *&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;100&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;stop&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; background: white; font-size: 12px; background-color: #ffffff; font-family: 'Courier New';"&gt;*now insert only NEW vehicleID into register ; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;PROC&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;SQL&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;undo_policy&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;= none ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;INSERT&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;INTO&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; LATEST_id &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;distinct&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; vehicleID, today(), &amp;amp;f &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; fileid&amp;amp;f &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; vehicleID not &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;in&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;( &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;select&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; vehicleID &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;from&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; latest_ID );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%put&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &amp;amp;f -----&amp;gt; &amp;amp;sqlobs ; &lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;*show number of inserts ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;quit&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;%end&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;%mend&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; pasttimes ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000; background: white; font-size: 12px; background-color: #ffffff; font-family: 'Courier New';"&gt;*now run 200 "days" ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;option&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;nomlogic&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;nosymbolgen&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;nomprint&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;%&lt;STRONG&gt;&lt;EM&gt;pasttimes&lt;/EM&gt;&lt;/STRONG&gt;( fromf=&lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;1&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;, tof= &lt;/SPAN&gt;&lt;STRONG style="color: teal; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;200&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;) ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: green; background: white;"&gt;*Now the reporting phase to get the number of new vehicleID by refN number;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;proc&lt;/STRONG&gt; &lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;summary&lt;/STRONG&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;data&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;= latest_ID ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;class&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; refN ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;output&lt;/SPAN&gt; &lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;out&lt;/SPAN&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;= refN_freq ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: navy; background: white; font-size: 9.0pt; font-family: 'Courier New';"&gt;run&lt;/STRONG&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 9.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Nov 2013 17:31:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Macro-help-for-data-step-automation/m-p/133186#M27096</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2013-11-10T17:31:16Z</dc:date>
    </item>
  </channel>
</rss>

