<?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: Question on a macro program meaning in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Question-on-a-macro-program-meaning/m-p/174028#M33433</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, ... to add onto the previous comments...&lt;/P&gt;&lt;P&gt;&amp;nbsp; And, the only possible reference to anything to do with SAS macro processing is this statement:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;directory =&lt;SPAN style="color: #ff0000;"&gt;'&lt;/SPAN&gt;&amp;amp;directory&lt;SPAN style="color: #ff0000;"&gt;'&lt;/SPAN&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which may or may not be a reference to a SAS macro variable. Do you know whether &lt;STRONG style="font-family: courier new,courier;"&gt;&amp;amp;directory&lt;/STRONG&gt; is a SAS macro variable? And if so, does this program even work? Can you find a statement where the value of &lt;STRONG style="font-family: courier new,courier;"&gt;&amp;amp;directory&lt;/STRONG&gt; is set (such as a %LET statement or a CALL SYMPUT)? One thing that you could find out about referencing SAS Macro variables is that they will not resolve correctly unless they are enclosed in double (") quotes. So unless you are creating a literal string of &lt;STRONG style="font-family: courier new,courier;"&gt; &lt;SPAN style="color: #ff0000;"&gt;'&lt;/SPAN&gt;&amp;amp;directory&lt;SPAN style="color: #ff0000;"&gt;' &lt;/SPAN&gt;&lt;/STRONG&gt;as the value for your directory data step variable, my suspicion is that your program is not working as you expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, this may be problematic:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;datalogread;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;because usually the keyword DATA is separated from the dataset name by a space. So your code could be:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DATA logread;&lt;/STRONG&gt; or &lt;STRONG style="font-family: courier new,courier;"&gt;DATA log read;&lt;/STRONG&gt; depending on whether you were creating 1 dataset in the WORK library or 2. Or, I suppose that LOG could be your LIBRARY and this is a possibility: &lt;STRONG style="font-family: courier new,courier;"&gt;DATA LOG.READ;&lt;/STRONG&gt; -- it really depends on what you expect to be the output of the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Jul 2014 15:40:15 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2014-07-10T15:40:15Z</dc:date>
    <item>
      <title>Question on a macro program meaning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-a-macro-program-meaning/m-p/174024#M33429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I came across a macro, and I believe I got the basic understanding of the program, but would like some confirmation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P class="p1"&gt;datalogread;&lt;/P&gt;&lt;P class="p1"&gt;length file $256 dye 8 dte1 8 directory $256;&lt;/P&gt;&lt;P class="p1"&gt;format dte datetime;&lt;/P&gt;&lt;P class="p1"&gt;keep file dye dte1 directory;&lt;/P&gt;&lt;P class="p1"&gt;length filrf filerfb $8;&lt;/P&gt;&lt;P class="p1"&gt;directory =‘&amp;amp;directory’;&lt;/P&gt;&lt;P class="p1"&gt;rc1=filename(filrf,directory);&lt;/P&gt;&lt;P class="p1"&gt;opdir=dopen(filrf);&lt;/P&gt;&lt;P class="p1"&gt;memcount=dnum(opdir);&lt;/P&gt;&lt;P class="p1"&gt;if opdir &amp;lt;=0 then put ‘ERROR: Unable to open log folder.’;&lt;/P&gt;&lt;P class="p1"&gt;do i=1 to memcount;&lt;/P&gt;&lt;P class="p1"&gt;file=dread(opdir,i);&lt;/P&gt;&lt;P class="p1"&gt;rc2=filename(filrfb,catx(‘\’,directory,file));&lt;/P&gt;&lt;P class="p1"&gt;fid=fopen(filrfb);&lt;/P&gt;&lt;P class="p1"&gt;dte=input (finfo(fid,’Create Time’),datetime.);&lt;/P&gt;&lt;P class="p1"&gt;dte1=dte;&lt;/P&gt;&lt;P class="p1"&gt;if dye &amp;gt;=&amp;amp;lastrun then output;&lt;/P&gt;&lt;P class="p1"&gt;rc3=fclose(fid)&lt;/P&gt;&lt;P class="p1"&gt;rc4=filename(filrfb);&lt;/P&gt;&lt;P class="p1"&gt;end;&lt;/P&gt;&lt;P class="p1"&gt;rc5=dclose(opdir);&lt;/P&gt;&lt;P class="p1"&gt;run;&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;Would appreciate another pair of eyes, to help me understand this program.&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;Your help on this is greatly appreciated.&lt;/P&gt;&lt;P class="p1"&gt;&lt;/P&gt;&lt;P class="p1"&gt;Thanks You.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 01:59:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-a-macro-program-meaning/m-p/174024#M33429</guid>
      <dc:creator>samchat</dc:creator>
      <dc:date>2014-07-10T01:59:37Z</dc:date>
    </item>
    <item>
      <title>Re: Question on a macro program meaning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-a-macro-program-meaning/m-p/174025#M33430</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What do you think it does? And what don't you understand?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best way to understand code when learning is to comment every line.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 03:24:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-a-macro-program-meaning/m-p/174025#M33430</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2014-07-10T03:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Question on a macro program meaning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-a-macro-program-meaning/m-p/174026#M33431</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually this is not a macro at all, just a datastep that looks for files in given directory that were created after a given date, using the SAS file and directory I/O functions.&lt;/P&gt;&lt;P&gt;The directory name and the date are obviously specified somewhere farther "up" in the code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To understand this, look at the documentation of the functions involved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And there are a lot of syntax and semantic errors.&lt;/P&gt;&lt;P&gt;- datalogread should be data logread&lt;/P&gt;&lt;P&gt;- the format statement will not work, as the format spec is missing the dot&lt;/P&gt;&lt;P&gt;- dye is in the keep list and in a condition, but never has a value assigned (is always missing)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 06:38:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-a-macro-program-meaning/m-p/174026#M33431</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2014-07-10T06:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: Question on a macro program meaning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-a-macro-program-meaning/m-p/174027#M33432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It looks like the program is indicating to go to a specified directory, check the files (possibly log files) and check the files for errors.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 09:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-a-macro-program-meaning/m-p/174027#M33432</guid>
      <dc:creator>samchat</dc:creator>
      <dc:date>2014-07-10T09:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: Question on a macro program meaning</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Question-on-a-macro-program-meaning/m-p/174028#M33433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, ... to add onto the previous comments...&lt;/P&gt;&lt;P&gt;&amp;nbsp; And, the only possible reference to anything to do with SAS macro processing is this statement:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;directory =&lt;SPAN style="color: #ff0000;"&gt;'&lt;/SPAN&gt;&amp;amp;directory&lt;SPAN style="color: #ff0000;"&gt;'&lt;/SPAN&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which may or may not be a reference to a SAS macro variable. Do you know whether &lt;STRONG style="font-family: courier new,courier;"&gt;&amp;amp;directory&lt;/STRONG&gt; is a SAS macro variable? And if so, does this program even work? Can you find a statement where the value of &lt;STRONG style="font-family: courier new,courier;"&gt;&amp;amp;directory&lt;/STRONG&gt; is set (such as a %LET statement or a CALL SYMPUT)? One thing that you could find out about referencing SAS Macro variables is that they will not resolve correctly unless they are enclosed in double (") quotes. So unless you are creating a literal string of &lt;STRONG style="font-family: courier new,courier;"&gt; &lt;SPAN style="color: #ff0000;"&gt;'&lt;/SPAN&gt;&amp;amp;directory&lt;SPAN style="color: #ff0000;"&gt;' &lt;/SPAN&gt;&lt;/STRONG&gt;as the value for your directory data step variable, my suspicion is that your program is not working as you expect.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In addition, this may be problematic:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&lt;STRONG&gt;datalogread;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;because usually the keyword DATA is separated from the dataset name by a space. So your code could be:&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;DATA logread;&lt;/STRONG&gt; or &lt;STRONG style="font-family: courier new,courier;"&gt;DATA log read;&lt;/STRONG&gt; depending on whether you were creating 1 dataset in the WORK library or 2. Or, I suppose that LOG could be your LIBRARY and this is a possibility: &lt;STRONG style="font-family: courier new,courier;"&gt;DATA LOG.READ;&lt;/STRONG&gt; -- it really depends on what you expect to be the output of the program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Jul 2014 15:40:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Question-on-a-macro-program-meaning/m-p/174028#M33433</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2014-07-10T15:40:15Z</dc:date>
    </item>
  </channel>
</rss>

