title: SAS: Break up long string in code
body: <p>I find it good practice to restrict my code to within 80 characters per line.  Since SAS ignores white space, this usually isn't a problem.  However, I occasionally need to refer to some string which is excessively long.  </p>
  
  <p>For example,</p>
  
  <pre><code>filename infile "B:\This\file\path\is\really\long\but\there\is\nothing\I\can\do\about\it\because\it\is\on\a\shared\network\drive\and\I\am\stuck\with\whatever\organization\or\lack\thereof\exists\for\directory\hierarchies\filename.txt";
  </code></pre>
  
  <hr>
  
  <p>I can think of two solutions:</p>
  
  <p>1) Insert a carriage return.  This however makes the code look quite messy and may unwittingly introduce invisible characters (i.e <code>\r\n</code>) into the string.</p>
  
  <pre><code>filename infile "B:\This\file\path\is\really\long\but\there\is\nothing\
  I\can\do\about\it\because\it\is\on\a\shared\network\drive\and\I\am\stuck\
  with\whatever\organization\or\lack\thereof\exists\for\directory\hierarchies\
  filename.txt";
  </code></pre>
  
  <p>2) Use macro variables to break the string into several parts.</p>
  
  <pre><code>%let part1 = B:\This\file\path\is\really\long\but\there\is\nothing\;
  %let part2 = I\can\do\about\it\because\it\is\on\a\shared\network\drive\and\I\am\stuck\;
  %let part3 = with\whatever\organization\or\lack\thereof\exists\for\directory\hierarchies\;
  %let part4 = filename.txt;
  
  filename infile "&amp;part1.&amp;part2.&amp;part3.&amp;part4.";
  
  %let path = %sysfunc(pathname(infile));
  %put &amp;path;
  </code></pre>
  
  <p>Ideally, I would like something which allows me to follow the indentation scheme of the rest of the code.</p>
  
  <pre><code>filename infile "B:\This\file\path\is\really\long\but\there\is\nothing\
    I\can\do\about\it\because\it\is\on\a\shared\network\drive\and\I\am\stuck\
    with\whatever\organization\or\lack\thereof\exists\for\directory\hierarchies\
    filename.txt";
  </code></pre>
  
  <p>A possible solution, at least within the context of this example, would be to bypass a declaration altogether and prompt the use for the input file.  This does not appear easy to implement, however.</p>