data xxx / debug
go -- until break 7
step = return
examine _all_
quit
set
break point:
/* =----------- debug examples -------
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000379345.htm
*/
/* debug example: first execution */
data tours (drop=type) ; * / debug;
retain Tour; /* add retain to keep the data */
input @1 type $ @;
if type='H' then
do;
input @3 Tour $20.;
return;
end;
else if type='P' then
do;
input @3 Name $10. Age 2. +1 Sex $1.;
output;
end;
datalines;
H Tour 101
P Mary E 21 F
P George S 45 M
P Susan K 3 F
H Tour 102
P Adelle S 79 M
P Walter P 55 M
P Fran I 63 F
;
run;
proc print data=tours;
title 'Tour List';
run;
/* =----------- debug example 2 -------*/
options yearcutoff=1920;
data tours / debug;
length Country $ 10;
input Country $10. Start : mmddyy. End : mmddyy.;
Duration=end-start;
datalines;
Italy 033000 041300
Brazil 021900 022800
Japan 052200 061500
Venezuela 110300 11800
Australia 122100 011501
;
proc print data=tours;
format start end date9.;
title 'Tour Duration';
run;
/* in debug: show output, then
1. break lineNo when country="Venezuela" --- break at error point
2. examine the date var: examine start date7. | examine start mmddyy.
3. set start='18Nov00'd
Debugger Commands:
http://www.sfu.ca/sasdoc/sashtml/lgref/z0379386.htm
-------------
BREAK lineNo ; breake 4 when strVar=''; break 4 when numVar=value;
break 4 after numberOf_Loop
JUMP lineNo
DELETE break lineNo
SET var=Value, when debug, can set some value for debug purpose
ENTER = step
STEP = excute a statement, step forward
EXAMINE varName, _ALL_
GO lineNo.
QUIT
CALCULATE expression
LIST
DESCRIBE
SWAP
TRACE
HELP
WATCH
*/
/* =----------- debug example 3 -------*/
/* break 331 after 5(loop repeat counts) */
data old;
input oldtest @@;
datalines;
2 3 3 4 4 4 5 5
;
run;
data new / debug;
set old;
do i=1 to 20;
newtest=oldtest+i;
output;
end;
run;
No comments:
Post a Comment