Discussion:
SAS session gets stuck sometimes
(too old to reply)
Ram
2005-10-18 13:57:13 UTC
Permalink
Hi

I am a beginner in SAS. Once in a while, when I do something real
stupid, SAS gets irretrievably stuck. Anything I punch in after that
just appears as text in the log. For example, this error came up one time--

ERROR: Macro keyword MEND appears as text. A semicolon or other
delimiter may be missing.

Is there anything I can do to get out of this mode and back to testing
my code, other than having to close/open SAS session itself. I tried to
look for kill process/job, but found nothing.
thanks,
Ram
Jerry Davis
2005-10-18 14:36:15 UTC
Permalink
Post by Ram
I am a beginner in SAS. Once in a while, when I do something real
stupid, SAS gets irretrievably stuck. Anything I punch in after that
just appears as text in the log. For example, this error came up one time--
You may just have an unbalanced quote or something. Submitting some
form of this string may help:

*';*";*/;

I can't remember the magic string that ends all quotes and comments.
Also, submitting a RUN statement may help.

Jerry
--
Jerry Davis
Experimental Statistics
UGA, CAES, Griffin Campus
David L Cassell
2005-10-18 17:44:43 UTC
Permalink
Post by Ram
I am a beginner in SAS. Once in a while, when I do something real
stupid, SAS gets irretrievably stuck. Anything I punch in after that
just appears as text in the log. For example, this error came up one time--
ERROR: Macro keyword MEND appears as text. A semicolon or other
delimiter may be missing.
Is there anything I can do to get out of this mode and back to testing
my code, other than having to close/open SAS session itself. I tried to
look for kill process/job, but found nothing.
I see that you have received some expert advice from some very expert
people.
Listen to what they have to say.

In addition, please put up with the nonsense I am about to spew. :-)

It's okay to be a beginner. We all were, at some point. Learning nifty
tricks
like a version of the 'magic string' to submit when things lock up is a good
start.

Try using the SAS enhanced editor (or any other editor which will do color-
coding for you) and paying attention to the colors. That can save you some
major headaches. If you're typing away and the color is still green, then
you
have made a mistake and you are still in a comment. Go back and see where
the comment was supposed to end, and fix it. Whew. One problem down.
If you find you're still in purple coloring, thne you have failed to end a
string
somewhere. Go back and end it with the right (single or double) quote mark
so the purple disappears from the text which isn't supposed to be purple.
And always end your data steps and proc steps with a RUN; statement (or a
QUIT; statement if they require it). These things can make your life
easier.

Also, really try NOT to use macro code yet. Think of macro programming as
a text substitution tool. Or a chipper-shredder. Macros and macro
programming
are really useful. And they can be a huge help, if you know what you're
doing.
They can also grind you to pieces if you're not careful with them. If
you're
just beginning in SAS, you probably don't need to be doing much with macros
yet. My policy is to use them whenever needed.. and avoid them whenever
they are NOT needed. Learning more of the richness of SAS will also help
you
see ways to avoid macro programming where it is not needed.

HTH,
David
--
David L. Cassell
mathematical statistician
Design Pathways
3115 NW Norwood Pl.
Corvallis OR 97330

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
gjh
2005-10-18 19:57:09 UTC
Permalink
Another point might be helpful is that SAS is intended to do the statistical
analysis. So everything is around this point. Base SAS and all the procs
are useful only when they are to be organized to do some statistical work
(around data). Macro is a way of organizing the Base sas and other procs, so
it is even further removed from the central role of sas. for your
reference.

JH
Post by Ram
Hi
I am a beginner in SAS. Once in a while, when I do something real
stupid, SAS gets irretrievably stuck. Anything I punch in after that
just appears as text in the log. For example, this error came up one time--
ERROR: Macro keyword MEND appears as text. A semicolon or other
delimiter may be missing.
Is there anything I can do to get out of this mode and back to testing
my code, other than having to close/open SAS session itself. I tried to
look for kill process/job, but found nothing.
thanks,
Ram
Lou
2005-10-19 00:30:18 UTC
Permalink
Post by gjh
Another point might be helpful is that SAS is intended to do the statistical
analysis. So everything is around this point. Base SAS and all the procs
are useful only when they are to be organized to do some statistical work
(around data). Macro is a way of organizing the Base sas and other procs, so
it is even further removed from the central role of sas. for your
reference.
SAS originally (some 30 or so years ago) was an acronym for Statistical
Analysis System. That was then and this is now. SAS is not "intended" for
statistical analysis any more than it is "intended" for constructing GUI
interfaces for data entry systems, though it is useful for both, and much
more besides.
Post by gjh
JH
Post by Ram
Hi
I am a beginner in SAS. Once in a while, when I do something real
stupid, SAS gets irretrievably stuck. Anything I punch in after that
just appears as text in the log. For example, this error came up one
time--
Post by Ram
ERROR: Macro keyword MEND appears as text. A semicolon or other
delimiter may be missing.
Is there anything I can do to get out of this mode and back to testing
my code, other than having to close/open SAS session itself. I tried to
look for kill process/job, but found nothing.
thanks,
Ram
Ram
2005-10-19 18:50:06 UTC
Permalink
Thank you all (Jerry, Toby, Ian, Ronald, Steve, David, gjh, Lou, Tom)
for all your replies.

Yes, I use enhanced editor - but submit my code in pieces to figure out
the log messages. And I am also following the wise decision to use
macros only after my plain code works alright. The next time I get
stuck, I have several magic strings & nuggets to look to now. :)

thanks,
Ram
Ram
2005-10-20 14:47:05 UTC
Permalink
I wanted to say a quick thanks to all of you again. I have had the
opportunity to use the magic strings (infact, several times) to get out
of a stuck situation. I knew what happened, from the error log - just
needed a chance to change my code and resubmit it. IT WORKS!!!

thanks guys - you are all very helpful.
Ram
S***@gmail.com
2005-10-20 21:07:30 UTC
Permalink
ctrl + break, in general.

more specific to the problem you mention, make sure you have ';' after
any LET statements in your macro and after your initial macro
definition (a common mistake)

best,

stephen gallagher
center for clinical epidemiology and biostatistics
university of pennsylvania
Post by Ram
Hi
I am a beginner in SAS. Once in a while, when I do something real
stupid, SAS gets irretrievably stuck. Anything I punch in after that
just appears as text in the log. For example, this error came up one time--
ERROR: Macro keyword MEND appears as text. A semicolon or other
delimiter may be missing.
Is there anything I can do to get out of this mode and back to testing
my code, other than having to close/open SAS session itself. I tried to
look for kill process/job, but found nothing.
thanks,
Ram
Ian Whitlock
2005-10-18 15:06:38 UTC
Permalink
Ram,

One of the problems of interactive programming is that the system needs
certain signals to proceed. As a beginner you have to learn what the
system is waiting for.

If you start a statement with *, the system will continue to eat code until
it comes to semi-colon signaling the end of the comment. Usually there are
lots of semi-colons, so the program may not work, but there is little
danger. But if you begin with /*, nothing will stop the system from eating
code until the signal */, and there are no messages. %MACRO is command to
start compiling a macro. All code until the signal %MEND will be eaten as
part of this macro.

The message you give indicates that the word "%MEND" was not seen as a
signal and the system is still waiting for the proper signal. In
interactive SAS there are no absolute commands. Context is everything and
macro can make the context much harder to understand.

To get out of this kind of trap, sometimes the "magic string",

*';*";*/;*);run;data w;run;

will work, and produce a message about the data set W. In this case you
can continue. When that doesn't work I try a sequence of %MEND statements
looking for a message that %MEND signal was found without a %MACRO. If
that fails I find it easiest to save work and get out of SAS, and start
over.

To understand the command let's look at the first part *'; If we are at a
statement boundary, it is a comment and harmless. If we are in a single
quoted string, we end the string and try to cause a statement boundary.
The rest of the "magic string" has similar explanations for different
contexts. The code does not handle all situations. For example, perhaps
two or more closing parentheses are needed or maybe the *'; causes a
problem because we are not in a quoted expression and we are not on a
statement boundary. Unfortunately the best order for the "magic string"
depends on knowing what the problem is, but it works often enough to be
worth trying.

If you still have lot's of problems, you might find it better to work with
an editor that allows you to submit batch SAS jobs. When teaching with
version 6.04 (15 years ago) I tried very hard to get students to see the
advantages of interactive processing, but times have changed as computers
have gotten faster and SAS more efficient, so that today the advantages of
interactive development are less clear.

Ian Whitlock
===============
Date: Tue, 18 Oct 2005 09:57:13 -0400
Reply-To: Ram <***@VIRGINIA.EDU>
Sender: "SAS(r) Discussion"
From: Ram <***@VIRGINIA.EDU>
Organization: University of Virginia
Subject: SAS session gets stuck sometimes
Comments: To: sas-l
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Hi
I am a beginner in SAS. Once in a while, when I do something real
stupid, SAS gets irretrievably stuck. Anything I punch in after that
just appears as text in the log. For example, this error came up one time--
ERROR: Macro keyword MEND appears as text. A semicolon or other
delimiter may be missing.
Is there anything I can do to get out of this mode and back to testing
my code, other than having to close/open SAS session itself. I tried to
look for kill process/job, but found nothing.
thanks,
Ram

Loading...