Help using Base SAS procedures

SAS proc stream : problem with linebreaks

Reply
Occasional Contributor
Posts: 16

SAS proc stream : problem with linebreaks

[ Edited ]

hi to all,

Server: Unix, SAS94M3

Client: Windows, Internet Explorer Edge

Part of my code:

    %let P_debug_log = %str(<INPUT TYPE='hidden' NAME='_DEBUG' VALUE='LOG'>);
    proc stream outfile=_webout quoting=both resetdelim='_do' ASIS;
    BEGIN
      %if "&_whattodo" ne "print" %then %do;
        <script language='JavaScript' type='text/javascript'>										
      	    function subForm(f,v) {
      	    	if (v !== '') {
      	    	  $('#'+ f).append('<INPUT TYPE="hidden" NAME="'+ v +'" VALUE="1">');
      	    	}
    	        $('#'+f).submit();   	 
    	      } 
          $(document).ready(function() {															
            $('#footButtons').append($('.footButton'));   /* move all elements with class=footButton to pageFooter */
            $('#footMessage').append($('.footMsg'));   
            $('form.log').append("&P_debug_log.");
          });																				
        </script>
      %end;
    ;;;;

With Option ASIS I expected the output to have at least the same linebreaks as my code (e.g. the JavaScript part).

 

But I get:

    </script>
         <script language='JavaScript' type='text/javascript'>                  function subForm(f,v) {         if (v !== '') {           $('#'+ f).append('<INPUT TYPE="hidden" NAME="'+ v +'" VALUE="1">');         }          $('#'+f).submit();             }
            $(document).ready(function() {                        $('#footButtons').append($('.footButton'));            $('#footMessage').append($('.footMsg'));            $('form.log').append("
    <INPUT TYPE=
    'hidden
    ' NAME=
    '_DEBUG
    ' VALUE=
    'LOG
    '
    >");       });                         </script>

Why are there in some cases linebreaks, in others not?

 

And why is the macrovariable split in the way it is?

I expected this:

 $('form.log').append("
 <INPUT TYPE='hidden' NAME='_DEBUG' VALUE='LOG'>
 ");

 

 

This leads to unpredictable JavaScript Errors, e.g. when a linebreak is within a JavaScript string. It seems as if there is an implicit LRECL 1024. This would be OK if linebreaks would be set as expected.

 

What I'm doing wrong?

Any hints?

 

TALIA,

frank

Valued Guide
Posts: 595

Re: SAS proc stream : problem with linebreaks

This question appears to have been asked and answered today on Stackoverflow - apparently removing ASIS resolves the issue....

 

https://stackoverflow.com/questions/46976868/sas-proc-stream-weird-linebreaks

Ask a Question
Discussion stats
  • 1 reply
  • 121 views
  • 0 likes
  • 2 in conversation