<?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: How to get dnum number for the following step in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501333#M486</link>
    <description>&lt;P&gt;Thank you for your suggestion, but it seems it does not work.&lt;/P&gt;&lt;P&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;BR /&gt;2:25&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set WORK.DT1 may be incomplete. When this step was stopped there were 0 observations and 4 variables.&lt;BR /&gt;WARNING: Data set WORK.DT1 was not replaced because this step was stopped.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 24.37 seconds&lt;BR /&gt;cpu time 1.74 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference NUMFILES not resolved.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The&lt;BR /&gt;condition was: &amp;amp;numfiles&lt;BR /&gt;ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;ERROR: The macro A will stop executing.&lt;/P&gt;</description>
    <pubDate>Thu, 04 Oct 2018 05:03:08 GMT</pubDate>
    <dc:creator>LAYMAN_YO</dc:creator>
    <dc:date>2018-10-04T05:03:08Z</dc:date>
    <item>
      <title>How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501312#M480</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;33&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;%macro a(libname=,domain=);&lt;BR /&gt;%let folder=C:\Users\SAS;&lt;/P&gt;&lt;P&gt;filename DIR1 "&amp;amp;folder";&lt;BR /&gt;data DT1 ;&lt;BR /&gt;length VAR $400 ;&lt;BR /&gt;*** Open directory ;&lt;BR /&gt;did = dopen("DIR1") ;&lt;/P&gt;&lt;P&gt;*** Store filename and label into dataset;&lt;BR /&gt;do i = 1 to dnum( did ) ;&lt;BR /&gt;VAR = scan(dread( did , i ),1,'.') ;&lt;BR /&gt;call symputx(compress('fname'||trim(i)),var);&lt;BR /&gt;output;&lt;BR /&gt;end;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;/*&amp;nbsp; I would like to get dnum(did) here instead of the actual number of 33 */&lt;/SPAN&gt;&lt;BR /&gt;%do i=1 %to 33;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;BR /&gt;proc transpose data=&amp;amp;libname..&amp;amp;&amp;amp;fname&amp;amp;i (obs=0) out=&amp;amp;&amp;amp;fname&amp;amp;i;&lt;BR /&gt;var _ALL_;&lt;BR /&gt;run;&lt;BR /&gt;data a1 ;&lt;BR /&gt;length domainkeys $ 400;&lt;BR /&gt;set &amp;amp;&amp;amp;fname&amp;amp;i end=eof;&lt;BR /&gt;retain domainkeys '';&lt;BR /&gt;domainkeys = trim(domainkeys) ||' '||trim(put(_name_,20.));&lt;BR /&gt;if eof then call symputx(compress("&amp;amp;&amp;amp;fname&amp;amp;i"||"KEEPSTRINGfd"),domainkeys, 'G' );&lt;BR /&gt;run;&lt;BR /&gt;%end;&lt;BR /&gt;%mend;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 02:02:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501312#M480</guid>
      <dc:creator>LAYMAN_YO</dc:creator>
      <dc:date>2018-10-04T02:02:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501320#M482</link>
      <description>&lt;P&gt;Read the output of the DNUM function into a variable as explained in the documentation:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/?docsetId=sclref&amp;amp;docsetTarget=p1j7tan0hegma8n1x7uu7cei4inb.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_blank"&gt;https://documentation.sas.com/?docsetId=sclref&amp;amp;docsetTarget=p1j7tan0hegma8n1x7uu7cei4inb.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 03:29:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501320#M482</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-10-04T03:29:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501325#M483</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I mean&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;%do i=1 %to dnum(did);&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;does not work.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 04:00:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501325#M483</guid>
      <dc:creator>LAYMAN_YO</dc:creator>
      <dc:date>2018-10-04T04:00:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501327#M484</link>
      <description>&lt;P&gt;You need to do this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;numfiles=dnum(did);
call symput('numfiles', strip(put(numfiles, 8.)));

....
....
%do i = 1 %to &amp;amp;numfiles;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Oct 2018 04:28:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501327#M484</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-10-04T04:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501333#M486</link>
      <description>&lt;P&gt;Thank you for your suggestion, but it seems it does not work.&lt;/P&gt;&lt;P&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;BR /&gt;2:25&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set WORK.DT1 may be incomplete. When this step was stopped there were 0 observations and 4 variables.&lt;BR /&gt;WARNING: Data set WORK.DT1 was not replaced because this step was stopped.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 24.37 seconds&lt;BR /&gt;cpu time 1.74 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;WARNING: Apparent symbolic reference NUMFILES not resolved.&lt;BR /&gt;ERROR: A character operand was found in the %EVAL function or %IF condition where a numeric operand is required. The&lt;BR /&gt;condition was: &amp;amp;numfiles&lt;BR /&gt;ERROR: The %TO value of the %DO I loop is invalid.&lt;BR /&gt;ERROR: The macro A will stop executing.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 05:03:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501333#M486</guid>
      <dc:creator>LAYMAN_YO</dc:creator>
      <dc:date>2018-10-04T05:03:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501342#M488</link>
      <description>&lt;P&gt;Depending on where you put the call symput(), it might happen that it is never executed (ie if no files are present there).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A better method of creating repeating code is to not use a %do loop, but to use call execute in a date _null_ step running off the dataset with dataset names.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 06:03:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501342#M488</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-04T06:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501346#M489</link>
      <description>&lt;P&gt;Please post the complete log including the source statements otherwise we have no way of working out what went wrong.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 06:32:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501346#M489</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2018-10-04T06:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501462#M519</link>
      <description>&lt;P&gt;A couple of items to consider.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First, to solve the problem entirely, you need to add a RUN statement to your DATA step.&amp;nbsp; Without it, SAS tries to evaluate the %DO loop boundaries before actually running the DATA step, and &amp;amp;NUMFILES does not yet exist (because the DATA step has not yet executed).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Second, this might be a little simpler and would get rid of the annoying conversion note:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;numfiles&lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;dnum&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;did&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
call &lt;SPAN class="token function"&gt;symputx&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;(&lt;/SPAN&gt;&lt;SPAN class="token string"&gt;'numfiles'&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;,&lt;/SPAN&gt; numfiles&lt;SPAN class="token punctuation"&gt;)&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Switching to CALL SYMPUTX performs the numeric to character conversion without a note, and automatically strips out any blanks caused by the conversion.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 13:22:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501462#M519</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2018-10-04T13:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501472#M520</link>
      <description>&lt;P&gt;Not using a run; is one of the little sins that people commit frequently, and that sometimes comes back and bites them in the behind.&lt;/P&gt;
&lt;P&gt;Like the dot for macro variables, a run; (in the right place) is never wrong, and sometimes direly needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have an inkling this will become Maxim 50.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 13:38:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501472#M520</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-04T13:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501705#M567</link>
      <description>&lt;P&gt;Thank you very much for your help.&lt;/P&gt;&lt;P&gt;I should have added "run".&lt;/P&gt;</description>
      <pubDate>Thu, 04 Oct 2018 23:24:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501705#M567</guid>
      <dc:creator>LAYMAN_YO</dc:creator>
      <dc:date>2018-10-04T23:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501750#M569</link>
      <description>&lt;P&gt;Please give the solution to &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;, because he caught the mistake. I just made a clever formulation out of it.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Oct 2018 05:59:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/501750#M569</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-10-05T05:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/502363#M654</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562"&gt;@Kurt_Bremser&lt;/a&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/150395"&gt;@LAYMAN_YO&lt;/a&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4954"&gt;@Astounding&lt;/a&gt;&amp;nbsp;I have marked the correct solution. Thanks, all!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Oct 2018 12:01:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/502363#M654</guid>
      <dc:creator>ShelleySessoms</dc:creator>
      <dc:date>2018-10-08T12:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to get dnum number for the following step</title>
      <link>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/502457#M677</link>
      <description>&lt;P&gt;Why are you using the list of files found in one directory to then find the variable names in datasets from a SAS libref?&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the libref is pointing to the same directory why not just query that metadata directly?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc contents data=&amp;amp;libname.._all_ noprint out=contents; run;
proc sort data=contents;
 by memname varnum;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 08 Oct 2018 17:14:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/How-to-get-dnum-number-for-the-following-step/m-p/502457#M677</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-10-08T17:14:54Z</dc:date>
    </item>
  </channel>
</rss>

