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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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