BookmarkSubscribeRSS Feed
rwnj
Calcite | Level 5

I'll premise by saying I am a very new SAS user.

Today I needed to debug some logic statements. Ordinarily in VBA I would execute the code in step mode (F8), and be able to see which statements/variables/calculations would be tripping me up. Is there any equivalent to this in SAS? If not, how would you recommend debugging long logic statements?

Thanks

2 REPLIES 2
Reeza
Super User

http://www2.sas.com/proceedings/sugi25/25/btu/25p052.pdf

Or you can end your program in certain places  (Add run early) and/or add put statements in relevant locations to see the status of variables through the data step.

You can also post here Smiley Happy

Astounding
PROC Star

rwnj,

Another quick and dirty method is to add this statement just before your DATA step:

options obs=0;

However, you might want to make sure that you won't destroy any permanent SAS data sets by replacing them with 0 observations.

Also, you have to realize that debugging tricky logic means more than getting rid of the error messages.  Even without error messages, there is the question of whether the logic does the right thing.  You may need to devise some data that will test what you expect the logic to do.

Good luck.

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
  • 771 views
  • 0 likes
  • 3 in conversation