2
votes

I tried to debug SAS batch program on UNIX using /DEBUG in data step, but it is throwing an error because /DEBUG can only be used in interactive mode. Error Message: ERROR: Cannot open X display. Check display name/server access authorization.

ERROR: Unable to initialize the DATA STEP Debugger environment.

Then I started running the SAS code with put (all)(=); But this is creating a very huge log file. Is there any other way to debug a SAS code not to print ERROR and N variables in log when there is an data error.

Thanks, Kumar.

2

2 Answers

1
votes

I just ran across http://www2.sas.com/proceedings/sugi25/25/btu/25p052.pdf, which discusses using the debugger in batch mode via the /LDEBUG switch. I didn't know/think/imagine that was possible.

pT

0
votes

You certainly can debug intelligently; what that means, is figure out what can go wrong, and use PUT statements to look at those variables.

You don't have to limit this to the log; for example, I might debug my data (in what I do, the data is more likely to be 'wrong' than my program, after I've finished writing the first iteration) by creating dataset that contains a WHERE statement that is obviously false given correct data, so if it contains an rows, it shows a problem - then PROC PRINT that dataset with an obvious title ("ERROR THIS HAS DATA AND SHOULD NOT BECAUSE OF *REASON*").

In terms of resolving how a data step is not working for your particular program, you can PUT things to the log in a few different places for just one iteration - set OBS=1 and then run things (if that is possible based on your program). Or output to a dataset at each step in the data step, so you can see the progression in a dataset rather than in the log.