BookmarkSubscribeRSS Feed
topkatz
Obsidian | Level 7
Hi.

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 = %
2752
2753 %let pctsign2 = %nrstr(%) ;
2754 %put pctsign2 = &pctsign2. ;
2755
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.

Thanks!

-- TMK --
"The Macro Klutz"
2 REPLIES 2
ArtC
Rhodochrosite | Level 12
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.
topkatz
Obsidian | Level 7
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.

Thanks!

-- TMK --

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 2 replies
  • 828 views
  • 0 likes
  • 2 in conversation