D******n 发帖数: 2836 | 1 Let me share with you some tricks or techniques i use to debug or facilitate
debugging SAS codes in Linux environment.
> proc print with obs= option. (ya very simple very naive)
> endsas statement.
> /* */ to comment out codes.
> sas -obs ### xxxx.sas (SAS options need not to be hard written in the
script, you can call it when batch running it)
> use put in data step to monitor SAS variable.
> use mprint, mlogic, symbolgen, source, source2 to debug macros.
> use %put to monitor macro variable.
> modularize your codes and encapsulate your macros.
Advanced:
> Write and use scripts to print (or count # of obs, or do freq or do basic
stat) SAS datasets directly to terminal.
> Use "sas -notermwork -work . yyyy.sas" to save WORK library and redirect
it to current folder for inspection.(To save time and disk space, use it in
conjunction with -obs ### option).
Any input out of your experience is welcomed. | k*****u 发帖数: 1688 | 2 dont forget to check ERROR WARNING in the log file.
send out output to email.
merge/inner join/ left join/ right join, don't forget to check if they are
correct. check if the key variable should be unique or not.
Join a small table with a large table, index them .
join a large table with a large table(I once did a 3M table left join
1billion table), proc sql left join takes more than 3 days and not finished.
Then I tried split the 2M table to a small table with 5k obs each, then use
macro and loops to join iteratively. I took about 2 days to finish.
huge table? Please hadoop. I tried a 30M obs table join with a 30M obs table
, Hive took less than 70 minutes.
--------------------
Let me share with you some tricks or techniques i use to debug or facilitate
debugging SAS codes in Linux environment.
> proc print with obs= option. (ya very simple very naive)
> endsas statement.
> /* */ to comment out codes.
> sas -obs ### xxxx.sas (SAS options need not to be hard written in the
script, you can call it when batch running it)
> use put in data step to monitor SAS variable.
> use mprint, mlogic, symbolgen, source, source2 to debug macros.
> use %put to monitor macro variable.
> modularize your codes and encapsulate your macros.
Advanced:
> Write and use scripts to print (or count # of obs, or do freq or do basic
stat) SAS datasets directly to terminal.
> Use "sas -notermwork -work . yyyy.sas" to save WORK library and redirect
it to current folder for inspection.(To save time and disk space, use it in
conjunction with -obs ### option).
Any input out of your experience is welcomed. | D******n 发帖数: 2836 | 3 I wrote a script to check all the error/warning messages.
I always run it when the SAS job is done.
finished.
use
table |
|