<?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: SAS macros in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81730#M256647</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Doesn't sound like a macro issue.&lt;/P&gt;&lt;P&gt;For example here is a data step to read your example data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards firstobs=2 dlm='|' truncover ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input patient ?? :9. status $40. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if patient ne . then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; recordno+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put _infile_ / recordno= ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;patient_id|desc&lt;/P&gt;&lt;P&gt;1|active&lt;/P&gt;&lt;P&gt;34|closed&lt;/P&gt;&lt;P&gt;33|joined on 23-apr-12&lt;/P&gt;&lt;P&gt;patient|01JAN2011|3&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Apr 2012 19:22:42 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2012-04-12T19:22:42Z</dc:date>
    <item>
      <title>SAS macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81729#M256646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a text file with the below format.&lt;/P&gt;&lt;P&gt;patient_id|desc&lt;/P&gt;&lt;P&gt;1|active&lt;/P&gt;&lt;P&gt;34|closed&lt;/P&gt;&lt;P&gt;33|joined on 23-apr-12&lt;/P&gt;&lt;P&gt;patient|01JAN2011|3&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first row is a header variable. The last row is a trailer with the file name, date the text file was sent and the record count.&lt;/P&gt;&lt;P&gt;I have loaded the data into a sas dataset. In that process , I also want to check if the record count in the trailer matches with the data that gets loaded into the sas dataset. I skip the trailer record when I load my data into the patient sas dataset.&lt;/P&gt;&lt;P&gt;If i could incorporate this logic into a macro and read the macro into the main sas job that loads the data into a dataset, it would be better. I need to do this check on 7 files.&lt;/P&gt;&lt;P&gt;Please advise as I am a beginner in sas and never used macros....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 18:39:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81729#M256646</guid>
      <dc:creator>iluvsas</dc:creator>
      <dc:date>2012-04-12T18:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81730#M256647</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Doesn't sound like a macro issue.&lt;/P&gt;&lt;P&gt;For example here is a data step to read your example data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards firstobs=2 dlm='|' truncover ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input patient ?? :9. status $40. ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if patient ne . then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; recordno+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put _infile_ / recordno= ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;cards;&lt;/P&gt;&lt;P&gt;patient_id|desc&lt;/P&gt;&lt;P&gt;1|active&lt;/P&gt;&lt;P&gt;34|closed&lt;/P&gt;&lt;P&gt;33|joined on 23-apr-12&lt;/P&gt;&lt;P&gt;patient|01JAN2011|3&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 19:22:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81730#M256647</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-04-12T19:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81731#M256648</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is the text file in Windows or Unix server?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 19:23:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81731#M256648</guid>
      <dc:creator>Hima</dc:creator>
      <dc:date>2012-04-12T19:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81732#M256649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Tom. I have already read the txt file and created a sas dataset. I want to write a macro to do the quality check by comparing the trailer record count to the number of records in the dataset after the load. How do i check this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 19:27:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81732#M256649</guid>
      <dc:creator>iluvsas</dc:creator>
      <dc:date>2012-04-12T19:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81733#M256650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The txt file is on a unix server. I do know how to load the txt file into a dataset. I want to know how to compare and validate the dataset records count with the trailer record count (here trailer count = 3) using a sas macro. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 19:29:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81733#M256650</guid>
      <dc:creator>iluvsas</dc:creator>
      <dc:date>2012-04-12T19:29:18Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81734#M256651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When you read the trailer record, create a macro variable using CALL SYMPUT('yourmacrovar', rowcountvar);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create yourself a little macro called NumObs to check the number of observations in a dataset:&lt;/P&gt;&lt;P&gt;&amp;nbsp; %macro numobs(dsn);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %global numobs;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let dsid=%sysfunc(open(&amp;amp;dsn));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let numobs=%sysfunc(attrn(&amp;amp;dsid,nobs));&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %let rc=%sysfunc(close(&amp;amp;dsid));&lt;BR /&gt;&amp;nbsp; %mend numobs;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then compare the two macro variables:&lt;/P&gt;&lt;P&gt;&amp;nbsp; %if &amp;amp;yourmacrovar=&amp;amp;numobs %then %let validated=YES;&lt;/P&gt;&lt;P&gt;&amp;nbsp; %else %let validated=NO;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Apr 2012 20:10:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81734#M256651</guid>
      <dc:creator>JasonDiVirgilio</dc:creator>
      <dc:date>2012-04-12T20:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: SAS macros</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81735#M256652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2012 20:26:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-macros/m-p/81735#M256652</guid>
      <dc:creator>iluvsas</dc:creator>
      <dc:date>2012-04-17T20:26:36Z</dc:date>
    </item>
  </channel>
</rss>

