<?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: Having Error with Do loop in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/355322#M274026</link>
    <description>&lt;P&gt;Issue solved. I've ginen longer charecter in fileref filesref=' &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you verymuch for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 02 May 2017 17:17:19 GMT</pubDate>
    <dc:creator>ravi15</dc:creator>
    <dc:date>2017-05-02T17:17:19Z</dc:date>
    <item>
      <title>Having Error with Do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/355280#M274023</link>
      <description>&lt;P&gt;/**************************************************************************************/&lt;BR /&gt;/* Program: PARSE_RTRACE_LOGS.sas */&lt;BR /&gt;/* */&lt;BR /&gt;/* Purpose: This program retrieves the file attributes owner, modified */&lt;BR /&gt;/* along with the creation timestamp and process id from the */&lt;BR /&gt;/* filename. */&lt;BR /&gt;/**************************************************************************************/&lt;BR /&gt;options msglevel=i;&lt;BR /&gt;/* location for historical dataset */&lt;BR /&gt;libname in1 "/SASHome/user";&lt;BR /&gt;/* location where rtrace logs are stored */&lt;BR /&gt;%let subdir=/SASHome/rtrace/Logs/;&lt;BR /&gt;data work.dirlist(keep=filename strUser ModDT CrDT strPID strSource);&lt;BR /&gt;/* must be explicitly set to blank to have the filename function generate a fileref */&lt;BR /&gt;fileref = ' ';&lt;BR /&gt;rc = filename(fileref,"&amp;amp;subdir");&lt;BR /&gt;/* open fileref and loop throughfilenames */&lt;BR /&gt;did=dopen(fileref);&lt;BR /&gt;do i = 1 to dnum(did);&lt;BR /&gt;/* extract filename */&lt;BR /&gt;fileName = dread(did,i);&lt;BR /&gt;/* find the position of PID in the filename */&lt;BR /&gt;pid_start = index(fileName,"PID")+3;&lt;BR /&gt;/* find the end position of PIF in filename */&lt;BR /&gt;pid_end = index(fileName,"DATE")-1;&lt;BR /&gt;/* extract PID */&lt;BR /&gt;strPID = substr(fileName,pid_start,pid_end - pid_start);&lt;BR /&gt;/* find the start of DATE in filename */&lt;BR /&gt;date_start = index(fileName,"DATE")+4;&lt;BR /&gt;/* find the end position of DATE in the filename */&lt;BR /&gt;date_end = index(fileName,":")-1;&lt;BR /&gt;/* set the start of the time field */&lt;BR /&gt;time_start = date_end +2;&lt;BR /&gt;/* find the end of the time field */&lt;BR /&gt;time_end = index(filename,".");&lt;BR /&gt;/* extract creation time */&lt;BR /&gt;tmpTime = Trim(substr(filename, time_start, time_end - time_start));&lt;BR /&gt;tmpHour = Substr(tmpTime,1, 2)*1;&lt;BR /&gt;tmpMin = Substr(tmpTime,3,2)*1;&lt;BR /&gt;tmpSec = Substr(tmpTime,5,2)*1;&lt;BR /&gt;/* extract creation date */&lt;BR /&gt;strDT = trim(substr(fileName,date_start,date_end - (date_start-1)));&lt;BR /&gt;tmpDT = input(put(strDT,8.),yymmdd8.);&lt;BR /&gt;CrDt = DHMS(put(tmpDT,8.),tmpHour,tmpMin,tmpSec);&lt;BR /&gt;fid = mopen(did,fileName);&lt;BR /&gt;infonum=foptnum(fid);&lt;BR /&gt;if fid then do;&lt;BR /&gt;/* extract userid */&lt;BR /&gt;strUser=finfo(fid, foptname(fid, 2));&lt;BR /&gt;/* extract file modified date */&lt;BR /&gt;ModDT=input(trim(finfo(fid, foptname(fid, 5))),datetime20.);&lt;BR /&gt;format ModDT CrDT datetime20.;&lt;BR /&gt;/* extract file location */&lt;BR /&gt;strSource = finfo(fid, foptname(fid, 1));&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;rc = dclose(did);&lt;BR /&gt;rc = filename(fileref);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When i run &amp;nbsp;this i am getting the ERROR about the Do loop as below&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Character values have been converted to numeric values at the places given by: (Line):(Column).&lt;BR /&gt;65:11 66:10 67:10 71:13&lt;BR /&gt;INFO: Character variables have defaulted to a length of 200 at the places given by: (Line):(Column). Truncation can result.&lt;BR /&gt;48:1 fileName&lt;BR /&gt;76:1 strUser&lt;BR /&gt;81:1 strSource&lt;BR /&gt;NOTE: Argument 1 to function DNUM(0) at line 46 column 14 is invalid.&lt;BR /&gt;&lt;STRONG&gt;ERROR: Invalid DO loop control information, either the INITIAL or TO expression is missing or the BY expression is missing, zero, &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;or invalid.&lt;/STRONG&gt;&lt;BR /&gt;fileref=# rc=0 did=0 i=1 fileName= pid_start=. pid_end=. strPID= date_start=. date_end=. time_start=. time_end=. tmpTime=&lt;BR /&gt;tmpHour=. tmpMin=. tmpSec=. strDT= tmpDT=. CrDt=. fid=. infonum=. strUser= ModDT=. strSource= _ERROR_=1 _N_=1&lt;BR /&gt;NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to&lt;BR /&gt;missing values.&lt;BR /&gt;Each place is given by: (Number of times) at (Line):(Column).&lt;BR /&gt;1 at 46:14&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help regarding this is much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you,&lt;/P&gt;&lt;P&gt;Ravi.&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 15:17:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/355280#M274023</guid>
      <dc:creator>ravi15</dc:creator>
      <dc:date>2017-05-02T15:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Having Error with Do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/355295#M274024</link>
      <description>&lt;P&gt;Some places to investigate ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;DNUM(0) means that DOPEN failed to find the file&amp;nbsp;you are looking for.&amp;nbsp; Perhaps it doesn't exist or ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps fileref=' ' defines FILEREF as a single character.&amp;nbsp; Perhaps the values you need to assign are longer than that.&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 16:01:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/355295#M274024</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-05-02T16:01:41Z</dc:date>
    </item>
    <item>
      <title>Re: Having Error with Do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/355298#M274025</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wel, its pretty difficult to debug all that code without all the other information. &amp;nbsp;So what I will point out to you is:&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;NOTE: Argument 1 to function DNUM(0) at line 46 column 14 is invalid.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This relates to the code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;rc = filename(fileref,"&amp;amp;subdir");&lt;BR /&gt;/* open fileref and loop throughfilenames */&lt;BR /&gt;did=dopen(fileref);&lt;BR /&gt;do i = 1 to dnum(did);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;It is sayin that did resolves to 0 - maybe fileref is not assigned, what is &amp;amp;subdir. resolving to, is is a valid path, do you have access etc. &amp;nbsp;At no point in that code is there a specification of &amp;amp;subdir. and even if there was I can't see your system to answer this. &amp;nbsp;You will need to debug this - see what &amp;amp;subdir resolves to then check that against what you have access to and make sure there is something in that folder.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 16:06:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/355298#M274025</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-05-02T16:06:06Z</dc:date>
    </item>
    <item>
      <title>Re: Having Error with Do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/355322#M274026</link>
      <description>&lt;P&gt;Issue solved. I've ginen longer charecter in fileref filesref=' &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you verymuch for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 17:17:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/355322#M274026</guid>
      <dc:creator>ravi15</dc:creator>
      <dc:date>2017-05-02T17:17:19Z</dc:date>
    </item>
    <item>
      <title>Re: Having Error with Do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/355325#M274027</link>
      <description>&lt;P&gt;Thank you very much for you help. I've to give longer space in the fileref&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fileref= ' &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ';&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2017 17:21:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/355325#M274027</guid>
      <dc:creator>ravi15</dc:creator>
      <dc:date>2017-05-02T17:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Having Error with Do loop</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/561722#M274028</link>
      <description>&lt;P&gt;Hello, Can you tell me how many characters you gave?&lt;/P&gt;</description>
      <pubDate>Mon, 27 May 2019 11:06:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Having-Error-with-Do-loop/m-p/561722#M274028</guid>
      <dc:creator>SriLaxman</dc:creator>
      <dc:date>2019-05-27T11:06:57Z</dc:date>
    </item>
  </channel>
</rss>

