<?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: Creating directory structure in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62364#M17738</link>
    <description>You have some other options to consider - refer to this tech document from the SAS support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website, which I found using the website's SEARCH command:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/techsup/technote/ts353.html" target="_blank"&gt;http://support.sas.com/techsup/technote/ts353.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Also, the "pipe" engine of FILENAME is mentioned in this SAS conference paper:&lt;BR /&gt;
&lt;BR /&gt;
Check out These Pipes: Using Microsoft Windows Commands from SAS®&lt;BR /&gt;
Brian Varney, COMSYS Business Analytics Practice, Kalamazoo, Michigan&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/forum2008/092-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/092-2008.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
    <pubDate>Thu, 06 Aug 2009 20:00:45 GMT</pubDate>
    <dc:creator>sbb</dc:creator>
    <dc:date>2009-08-06T20:00:45Z</dc:date>
    <item>
      <title>Creating directory structure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62362#M17736</link>
      <description>Hi,&lt;BR /&gt;
&lt;BR /&gt;
I need to create a directory structure through my SAS program.&lt;BR /&gt;
&lt;BR /&gt;
I was looking at DCREATE function.So, suppose I've to create a directory structure C:\DAG\SAS\Tests, from what I understand from the documentation is, I have to iteratively create each of the folders DAG,SAS and then Tests with 3 separate calls for DCREATE. Is this correct?&lt;BR /&gt;
Or, if there is any other function that takes the whole path C:\DAG\SAS\Tests and creates the whole directory structure, can someone please point me to that?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Neel</description>
      <pubDate>Thu, 06 Aug 2009 19:02:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62362#M17736</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-06T19:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: Creating directory structure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62363#M17737</link>
      <description>Yes, you must create each level individually (as the DOC states, "create a directory").&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 06 Aug 2009 19:14:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62363#M17737</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-06T19:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Creating directory structure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62364#M17738</link>
      <description>You have some other options to consider - refer to this tech document from the SAS support &lt;A href="http://support.sas.com/" target="_blank"&gt;http://support.sas.com/&lt;/A&gt;  website, which I found using the website's SEARCH command:&lt;BR /&gt;
&lt;BR /&gt;
&lt;A href="http://support.sas.com/techsup/technote/ts353.html" target="_blank"&gt;http://support.sas.com/techsup/technote/ts353.html&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Also, the "pipe" engine of FILENAME is mentioned in this SAS conference paper:&lt;BR /&gt;
&lt;BR /&gt;
Check out These Pipes: Using Microsoft Windows Commands from SAS®&lt;BR /&gt;
Brian Varney, COMSYS Business Analytics Practice, Kalamazoo, Michigan&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/forum2008/092-2008.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/forum2008/092-2008.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Scott Barry&lt;BR /&gt;
SBBWorks, Inc.</description>
      <pubDate>Thu, 06 Aug 2009 20:00:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62364#M17738</guid>
      <dc:creator>sbb</dc:creator>
      <dc:date>2009-08-06T20:00:45Z</dc:date>
    </item>
    <item>
      <title>Re: Creating directory structure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62365#M17739</link>
      <description>Hi!&lt;BR /&gt;
You can use this macro (if you use Windows).&lt;BR /&gt;
&lt;BR /&gt;
  %MACRO MD(DIR=d:\bd_comp\data\2005\m6);&lt;BR /&gt;
  %LET COUNT=0;&lt;BR /&gt;
  %LET DLM=\;&lt;BR /&gt;
  %IF %SUBSTR(&amp;amp;DIR,%LENGTH(&amp;amp;DIR),1) NE &amp;amp;DLM %THEN %DO;&lt;BR /&gt;
  %LET DIR=&amp;amp;DIR&amp;amp;DLM;&lt;BR /&gt;
  %END;&lt;BR /&gt;
  %DO J=1 %TO %LENGTH(&amp;amp;DIR);&lt;BR /&gt;
  %IF %SUBSTR(&amp;amp;DIR,&amp;amp;J,1)=&amp;amp;DLM %THEN %DO;&lt;BR /&gt;
  %LET COUNT=%EVAL(&amp;amp;COUNT+1);&lt;BR /&gt;
  %END; %END;&lt;BR /&gt;
  %LET DRIVE=%SUBSTR(&amp;amp;DIR,1,3);&lt;BR /&gt;
  %LET LEVEL=&amp;amp;DRIVE;&lt;BR /&gt;
  %DO I=2 %TO &amp;amp;COUNT;&lt;BR /&gt;
  %LET WORD=%SCAN(&amp;amp;DIR,&amp;amp;I,&amp;amp;DLM);&lt;BR /&gt;
  %LET LNEW=&amp;amp;LEVEL&amp;amp;WORD&amp;amp;DLM;&lt;BR /&gt;
  data _null_;&lt;BR /&gt;
  rc=filename('newdir',"&amp;amp;lnew");&lt;BR /&gt;
  c=dopen('newdir');&lt;BR /&gt;
  if c=0 then new=dcreate("&amp;amp;word","&amp;amp;level");&lt;BR /&gt;
  run;&lt;BR /&gt;
  %LET LEVEL=&amp;amp;LNEW;&lt;BR /&gt;
  %END;&lt;BR /&gt;
  %MEND MD;</description>
      <pubDate>Fri, 07 Aug 2009 04:39:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62365#M17739</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2009-08-07T04:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Creating directory structure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62366#M17740</link>
      <description>You can also use x command:&lt;BR /&gt;
&lt;BR /&gt;
options noxwait;&lt;BR /&gt;
x "md d:\work\dir_c";</description>
      <pubDate>Fri, 07 Aug 2009 04:50:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62366#M17740</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2009-08-07T04:50:29Z</dc:date>
    </item>
    <item>
      <title>Re: Creating directory structure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62367#M17741</link>
      <description>Thanks for your help!</description>
      <pubDate>Fri, 07 Aug 2009 16:50:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62367#M17741</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-07T16:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Creating directory structure</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62368#M17742</link>
      <description>Thanks a lot!&lt;BR /&gt;
&lt;BR /&gt;
I found the paper with information about pipe helpful.&lt;BR /&gt;
&lt;BR /&gt;
I got it working.&lt;BR /&gt;
&lt;BR /&gt;
My macro is&lt;BR /&gt;
&lt;BR /&gt;
-------------------------------------------------------------&lt;BR /&gt;
%macro createFolder(folderName);&lt;BR /&gt;
&lt;BR /&gt;
/* Executing windows command */&lt;BR /&gt;
filename pipmkdir pipe "mkdir &amp;amp;folderName";&lt;BR /&gt;
data _null_;&lt;BR /&gt;
infile pipmkdir;&lt;BR /&gt;
&lt;BR /&gt;
%mend;&lt;BR /&gt;
&lt;BR /&gt;
--------------------------------------------------------------------&lt;BR /&gt;
&lt;BR /&gt;
Though, with known issue of mkdir, when there is a space in a folder name,&lt;BR /&gt;
say for example C:\DAG\Unit Test, then the mkdir will not work as expected.&lt;BR /&gt;
But putting double quotes around the folder name will work like mkdir "C:\DAG\Unit Test"&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I was not able to figure out how to have double quotes around the folderName parameter in the macro..&lt;BR /&gt;
&lt;BR /&gt;
I want to change the line in macro&lt;BR /&gt;
filename pipmkdir pipe "mkdir &amp;amp;folderName";&lt;BR /&gt;
&lt;BR /&gt;
to&lt;BR /&gt;
filename pipmkdir pipe "mkdir "&amp;amp;folderName" "; (I tried this, didn't work)&lt;BR /&gt;
&lt;BR /&gt;
Is there any escape character for having double quotes in a string?&lt;BR /&gt;
&lt;BR /&gt;
Thanks,&lt;BR /&gt;
Neel</description>
      <pubDate>Fri, 07 Aug 2009 16:58:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Creating-directory-structure/m-p/62368#M17742</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-08-07T16:58:54Z</dc:date>
    </item>
  </channel>
</rss>

