<?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: Marco questions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329543#M73742</link>
    <description>Thsnks astounding I change the number to 7 and it brought in the 2 thst was missing. I will run a full set of data to see if it fixes it</description>
    <pubDate>Thu, 02 Feb 2017 19:54:12 GMT</pubDate>
    <dc:creator>Gil_</dc:creator>
    <dc:date>2017-02-02T19:54:12Z</dc:date>
    <item>
      <title>Marco questions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329511#M73728</link>
      <description>I have a table named Raw&lt;BR /&gt;That looks like this&lt;BR /&gt;&lt;BR /&gt;Create date Tracking number AtM1&lt;BR /&gt;01/25/17. 1ZT248. Bagbar:"RS7779704"&lt;BR /&gt;&lt;BR /&gt;Atm2. Atm3&lt;BR /&gt;ATMBAR:"IN6618220125. Bagbar:"RS7779703"&lt;BR /&gt;&lt;BR /&gt;ATM4. ATM5&lt;BR /&gt;ATMBAR: "IN540322025" BAGBAR:"RS7779167"&lt;BR /&gt;txt me? 352-440-3968&lt;BR /&gt;&lt;BR /&gt;ATM8&lt;BR /&gt;ATMBAR:"IN1933220125"&lt;BR /&gt;&lt;BR /&gt;these are in one row horizontal the macro looks like this&lt;BR /&gt;&lt;BR /&gt;Proc sql no print;&lt;BR /&gt;Create table numatms as select&lt;BR /&gt;Distinct name,input (substr (name,4,4),8.0) as num&lt;BR /&gt;From sashelp.vcolumn where libname='work' and memname='RAW' and substr (name,1,3)="ATM"&lt;BR /&gt;ORDER BY 2;&lt;BR /&gt;QUIT;&lt;BR /&gt;PROC SQL NO print ; select max (num) into :nuatms from numatms;quit;&lt;BR /&gt;%put &amp;amp;numatms;&lt;BR /&gt;Proc sort data =raws; by Createdate trackingnumber; run;&lt;BR /&gt;Data outputs_results;run;&lt;BR /&gt;&lt;BR /&gt;%Marco c (i);&lt;BR /&gt;%let j=%sysfunc (sum (&amp;amp;i,1));&lt;BR /&gt;%put &amp;amp;j.;&lt;BR /&gt;&lt;BR /&gt;Data ext ( rename=(atm&amp;amp;i=atm_bag atm&amp;amp;j=atm_bar));&lt;BR /&gt;Format Createdate date9. Trackingnumber $18.;&lt;BR /&gt;Length atmi. Atmj. $256;&lt;BR /&gt;Set raw (keep=Createdate trackingnumber atm&amp;amp;i. Atm&amp;amp;j. );&lt;BR /&gt;Run;&lt;BR /&gt;&lt;BR /&gt;Data outputs_results;&lt;BR /&gt;Set outputs_results ext;&lt;BR /&gt;Label atm_bag ="ATM" ATM_BAR="ATM";&lt;BR /&gt;IF CREATEDATE =. then delete;&lt;BR /&gt;Run;&lt;BR /&gt;%mend;&lt;BR /&gt;%marco r;&lt;BR /&gt;%do k=1 %to &amp;amp;numatms;&lt;BR /&gt;%if %sysfunc (mod (&amp;amp;k.,4))=1%then %do;&lt;BR /&gt;%c (&amp;amp;k);&lt;BR /&gt;%end;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;BR /&gt;%r&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Output&lt;BR /&gt;Is only 2 out of 4&lt;BR /&gt;Barcode RS7779704&lt;BR /&gt;BARCODE RS7779167&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I don't know why it excludes the other two ... there is no spaces or character&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;</description>
      <pubDate>Thu, 02 Feb 2017 17:33:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329511#M73728</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-02-02T17:33:50Z</dc:date>
    </item>
    <item>
      <title>Re: Marco questions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329512#M73729</link>
      <description />
      <pubDate>Thu, 02 Feb 2017 17:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329512#M73729</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-02-02T17:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Marco questions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329517#M73730</link>
      <description>&lt;P&gt;It is very hard to follow what your data is, the result and what you expected. It helps to post your data in the form of data step code so we can understand what you have or your result actually looked like. Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; show how to creat datastep code from a SAS data set. You should paste the code in a forum code box opened with the {i} icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One possbile contributor is this line in your Proc SQL code:&lt;/P&gt;
&lt;P&gt;From sashelp.vcolumn where libname='work' and memname='RAW' and substr (name,1,3)="ATM"&lt;/P&gt;
&lt;P&gt;The values for LIbname and memname are both stored in UPPERCASE only. So you may not be getting the results you expect. Secondarily the NAME is in mixed case so if the variable is 'atm2' then substr (name,1,3)="ATM" won't match. Use substr(upcase (name,1,3))="ATM" to fix that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not sure what you are attempting but the code as written only keeps 2 atm variables if that is what you a re asking about:&lt;/P&gt;
&lt;P&gt;Set raw (keep=Createdate trackingnumber atm&amp;amp;i. Atm&amp;amp;j. );&lt;/P&gt;
&lt;P&gt;If you post some data and what the expected result for that example data is then we may be able to provide more help. A description of what you are actually attempting wouldn't hurt.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 17:55:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329517#M73730</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-02-02T17:55:57Z</dc:date>
    </item>
    <item>
      <title>Re: Marco questions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329521#M73732</link>
      <description>&lt;P&gt;I can't take the time to thoroughly analyze this, but there is a prime suspect here:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%if %sysfunc (mod (&amp;amp;k.,4))=1%then %do;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This statement means that your interior macro executes for every 4th line only (k=1, k=5, k=9, k=13, etc.).&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That logic may have been inserted for testing purposes, or perhaps to obtain a sample of the incoming data.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Feb 2017 18:25:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329521#M73732</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-02-02T18:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: Marco questions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329543#M73742</link>
      <description>Thsnks astounding I change the number to 7 and it brought in the 2 thst was missing. I will run a full set of data to see if it fixes it</description>
      <pubDate>Thu, 02 Feb 2017 19:54:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329543#M73742</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-02-02T19:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: Marco questions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329848#M73848</link>
      <description>I tried the uppercase same results the raw data looks like this&lt;BR /&gt;Date tracking ATM1 ATM2 ATM3 ATM4 ATM5 ATM6&lt;BR /&gt;The out put I would like to see&lt;BR /&gt;Date tracking ATM1 ATM2&lt;BR /&gt;Date tracking ATM3 ATM4&lt;BR /&gt;Date tracking ATM5 ATM6&lt;BR /&gt;</description>
      <pubDate>Fri, 03 Feb 2017 17:40:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329848#M73848</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-02-03T17:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Marco questions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329854#M73852</link>
      <description>I tried the uppercase same results the raw data looks like this&lt;BR /&gt;Date tracking ATM1 ATM2 ATM3 ATM4 ATM5 ATM6&lt;BR /&gt;The out put I would like to see&lt;BR /&gt;Date tracking ATM1 ATM2&lt;BR /&gt;Date tracking ATM3 ATM4&lt;BR /&gt;Date tracking ATM5 ATM6&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Once I change the number%if %sysfunc (mod (&amp;amp;k.,4))=1%then %do; to 7 the col would overlap&lt;BR /&gt;it shows&lt;BR /&gt;ATM ATM&lt;BR /&gt;</description>
      <pubDate>Fri, 03 Feb 2017 17:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Marco-questions/m-p/329854#M73852</guid>
      <dc:creator>Gil_</dc:creator>
      <dc:date>2017-02-03T17:50:54Z</dc:date>
    </item>
  </channel>
</rss>

