BookmarkSubscribeRSS Feed
balu_g
Fluorite | Level 6
data weight_club;  
   input IdNumber 1-4 Name $ 6-24 Team $ StartWeight EndWeight; 
   Loss=StartWeight-EndWeight;
   datalines; 
1023 David Shaw          red 189 165 
1049 Amelia Serrano      yellow 145 124 
1219 Alan Nance          red 210 192 
1246 Ravi Sinha          yellow 194 177  
1078 Ashley McKnight     red 127 118  
; 
run;  

my question is how to trace this program , line by line and control goes from which statement to which statement?

 

4 REPLIES 4
Reeza
Super User

What do you mean by TRACE? Typically this is a process to determine the flow of a program. 

 

What are are you looking for as output?

LinusH
Tourmaline | Level 20

You might want to look at the data step debugger. Available in DMS SAS (SAS old fat client) or the latest version of Enterprise Guide.

 

If that's not feasible, insert PUT statements in the code to track whats happening and what values variables have.

Data never sleeps
AhmedAl_Attar
Rhodochrosite | Level 12

Hi,

If you want to trace/debug the flow of a SAS data step, you can use the /debug option.

example: data weight_club / debug; ..... run;

 

To see more example and debug commands usage example, checkout this link DATA Step Debugger

 

Hope this helps,

Ahmed

Astounding
PROC Star

If this is what you mean by "trace", you would normally add PUT statements to a DATA step.  For example, after the DATA statement, add:

 

put '#1 ' _all_;

 

After the INPUT statement, add:

 

put '#2 ' _all_;

 

After the LOSS= statement, add:

 

put '#3 ' _all_;

 

If you are dealing with large numbers of observations, you might want to limit the number of messages you get.  For example, yo u might limit the number of observations read in using OBS=, or you might condition the PUT statements by adding:

 

If _n_ < 10 then put ......;

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
  • 4 replies
  • 2122 views
  • 0 likes
  • 5 in conversation