BookmarkSubscribeRSS Feed
defaz
Fluorite | Level 6

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

1 REPLY 1
ChrisBrooks
Ammonite | Level 13

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

sas-innovate-white.png

🚨 Early Bird Rate Extended!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.

 

Lock in the best rate now before the price increases on April 1.

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 898 views
  • 0 likes
  • 2 in conversation