<?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: Problems with Macro to Create a Directory in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-Macro-to-Create-a-Directory/m-p/215797#M39821</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Without knowing what is being fed into the macro I can't be entirely sure what your problem is. The error that you are receiving means that the macro variable "DIR" has not been created. This would occur if none of the above conditions were met for "ProjNo". I would begin by creating a data integrity test where you set the default value of "DIR" to "Error". Then verify that the "DIR" value has been changed before attempting to assign the libname. You can also try "options mlogic" to see how each of the above conditions are evaluating.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best of luck,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Aug 2015 16:16:44 GMT</pubDate>
    <dc:creator>ddemilla</dc:creator>
    <dc:date>2015-08-03T16:16:44Z</dc:date>
    <item>
      <title>Problems with Macro to Create a Directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-Macro-to-Create-a-Directory/m-p/215795#M39819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi,&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;I had this macro working the other day but must have accidentally changed it because it now gives me an error that the "apparent symbolic reference DIR not resolved."&amp;nbsp; The value of UVPERIOD is 150630 and the value of ProjNo is 6913, so YY resolves to 15 and QQYY resolves to 2Q15.&amp;nbsp; I'm sure it's something super obvious to someone who does a fair amount of SAS macro coding, but I'm not that person and I've already spent quite a bit of time trying to get this working again.&amp;nbsp; Any help to get this working again would be greatly appreciated!&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%LET YY = %SUBSTR(&amp;amp;UVPERIOD,1,2);&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%MACRO SETQQYY;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%IF %SUBSTR(&amp;amp;UVPERIOD,3,2) = 06 %THEN %LET QQYY = 2Q&amp;amp;YY;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%IF %SUBSTR(&amp;amp;UVPERIOD,3,2) = 12 %THEN %LET QQYY = 4Q&amp;amp;YY;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%MEND SETQQYY;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%SETQQYY;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%MACRO SETDIR;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%IF &amp;amp;ProjNo &amp;gt;= 6000 AND &amp;amp;ProjNo &amp;lt; 6500 %THEN %LET DIR = 6000-6499\&amp;amp;ProjNo-AWD-Market Share &amp;amp;QQYY\SAS Data;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%IF &amp;amp;ProjNo &amp;gt;= 6500 AND &amp;amp;ProjNo &amp;lt; 7000 %THEN %LET DIR = 6500-6999\&amp;amp;ProjNo-AWD-Market Share &amp;amp;QQYY\SAS Data;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%IF &amp;amp;ProjNo &amp;gt;= 7000 AND &amp;amp;ProjNo &amp;lt; 7500 %THEN %LET DIR = 7000-7499\&amp;amp;ProjNo-AWD-Market Share &amp;amp;QQYY\SAS Data;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%IF &amp;amp;ProjNo &amp;gt;= 7500 AND &amp;amp;ProjNo &amp;lt; 8000 %THEN %LET DIR = 7500-7999\&amp;amp;ProjNo-AWD-Market Share &amp;amp;QQYY\SAS Data;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%IF &amp;amp;ProjNo &amp;gt;= 8000 AND &amp;amp;ProjNo &amp;lt; 8500 %THEN %LET DIR = 8000-8499\&amp;amp;ProjNo-AWD-Market Share &amp;amp;QQYY\SAS Data;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%IF &amp;amp;ProjNo &amp;gt;= 8500 AND &amp;amp;ProjNo &amp;lt; 9000 %THEN %LET DIR = 8500-8999\&amp;amp;ProjNo-AWD-Market Share &amp;amp;QQYY\SAS Data;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%MEND SETDIR;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%SETDIR;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;%PUT &amp;amp;UVPERIOD &amp;amp;PROJNO &amp;amp;YY &amp;amp;QQYY &amp;amp;DIR;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;LIBNAME DAT2&amp;nbsp;&amp;nbsp; "&lt;A&gt;\\afcorp.afg\afhomeoffice\GroupShares\SDD\STRATRCH\PROJECTS\&amp;amp;DIR&lt;/A&gt;";&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Thanks,&lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;Bryan&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 16:09:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-with-Macro-to-Create-a-Directory/m-p/215795#M39819</guid>
      <dc:creator>BryanMarks</dc:creator>
      <dc:date>2015-08-03T16:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with Macro to Create a Directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-Macro-to-Create-a-Directory/m-p/215796#M39820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You probably before had created the macro variable DIR before calling the macro %SETDIR so that the macro updated the existing macro variable.&lt;/P&gt;&lt;P&gt;If you run %SETDIR and the macro variable DIR is not yet defined then it will be created as local to SETDIR and disappear when SETDIR ends.&lt;/P&gt;&lt;P&gt;You can just set it first.&lt;/P&gt;&lt;P&gt;%let dir=&amp;lt;unknown&amp;gt; ;&lt;/P&gt;&lt;P&gt;%setdir;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you could add %GLOBAL DIR; to the macro definition.&amp;nbsp; Or better do it conditionally.&lt;/P&gt;&lt;P&gt;%if not %symexist(dir) %then %global dir ;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 16:14:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-with-Macro-to-Create-a-Directory/m-p/215796#M39820</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-08-03T16:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with Macro to Create a Directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-Macro-to-Create-a-Directory/m-p/215797#M39821</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Without knowing what is being fed into the macro I can't be entirely sure what your problem is. The error that you are receiving means that the macro variable "DIR" has not been created. This would occur if none of the above conditions were met for "ProjNo". I would begin by creating a data integrity test where you set the default value of "DIR" to "Error". Then verify that the "DIR" value has been changed before attempting to assign the libname. You can also try "options mlogic" to see how each of the above conditions are evaluating.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best of luck,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 16:16:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-with-Macro-to-Create-a-Directory/m-p/215797#M39821</guid>
      <dc:creator>ddemilla</dc:creator>
      <dc:date>2015-08-03T16:16:44Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with Macro to Create a Directory</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problems-with-Macro-to-Create-a-Directory/m-p/215798#M39822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Tom!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That fixed it.&amp;nbsp; I had thought about adding the %Let Dir = ; statement prior to the %Macro statement, but hadn't tried it yet.&amp;nbsp; I was trying to remember if that was how I'd done it before but you already answered before giving that a shot.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bryan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Aug 2015 16:18:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problems-with-Macro-to-Create-a-Directory/m-p/215798#M39822</guid>
      <dc:creator>BryanMarks</dc:creator>
      <dc:date>2015-08-03T16:18:07Z</dc:date>
    </item>
  </channel>
</rss>

