DATA Step, Macro, Functions and more

Can I recover my SAS Windows session?

Posts: 27

Can I recover my SAS Windows session?


I made a mistake, and now I can't submit anything. Here is my log from where I made the error:

2750 %let pctsign1 = %str(%%) ;
2751 %put pctsign1 = &pctsign1. ;
pctsign1 = %
2753 %let pctsign2 = %nrstr(%) ;
2754 %put pctsign2 = &pctsign2. ;
2756 %let pctsign2 = %nrstr(%%) ;
2757 %put pctsign2 = &pctsign2. ;
2758 ;
2759 %put pctsign1 = &pctsign1. ;
2760 run ;
2761 %put pctsign1 = &pctsign1. ;
2762 %put pctsign1 = &pctsign1. ;

Line 2753 was where I made the fatal mistake. I wanted to see whether %nrstr(%) would mask % as indicated in the online documentation. After that, nothing worked. For the next few submissions, the submitted statements would print to the log, but after line 2762, not even the log would register my submissions. Is there any way to get this session working again, or do I have to shut down SAS and restart it? I even tried the magic string to overcome open code recursion:

*'; *"; *); */; %mend; run;

but that didn't produce any response.


-- TMK --
"The Macro Klutz"
Valued Guide
Posts: 653

Re: Can I recover my SAS Windows session?

The macro facility has a bit of trouble recovering from missing close parentheses like you specified in the %NRSTR function. The problem was actually aggrivated by the use of the 'magic string' If you had only specified the close parenthesis you would have been ok.

At this point you probably also have some mismatched quotes inside of a %NRSTR function. You may still be able to undo your quotes so that you can close the function. If it is worth it.
Posts: 27

Re: Can I recover my SAS Windows session?

Thank you for the response, Art.

Ah, I guess that in "%nrstr(%);" the "%" thinks that it is modifying the ")" rather than standing alone, so the %nrstr function has not been properly closed. Okay. I actually closed my SAS session window and restarted SAS, because I had to move on, but at least I have a clue about what went wrong.


-- TMK --
Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation