Hello,
I need to add checkpoints at each stage and a restart from checkpoint to the code below. I will be running this code monthly and if it fails at any point, I will need to restart it at the point in which it failed, instead of rerunning the entire program again. I would like to be notified as well if there is an error. Would anyone be able to assist me with this?
PROC SQL;
CREATE TABLE work.mobpp1 AS
SELECT DISTINCT soc, feature_code, rate,
datepart(effective_date)format=mmddyy10. AS effective_date,
datepart(sys_creation_date)format=mmddyy10. AS sys_creation_date,
datepart(expiration_date)format=mmddyy10. AS expiration_date,
"&sysdate"d as Extract_Date format= MONYY7.
FROM bmlrwork.pp_rc_rate
WHERE feature_code NOT IN ('PNETRM');
QUIT;
PROC SQL;
CREATE TABLE work.mobpp2 AS
SELECT DISTINCT soc, soc_description, product_type, service_provider
FROM bmlrwork.soc;
QUIT;
PROC SQL;
CREATE TABLE work.mobpp3 AS
SELECT DISTINCT t1.soc, t1.feature_code, t1.rate, t1.effective_date, t1.sys_creation_date, t1.expiration_date,
t2.soc_description, t2.product_type, t2.service_provider, t1.Extract_Date
FROM work.mobpp1 AS t1
LEFT JOIN work.mobpp2 AS t2
ON t1.soc = t2.soc;
QUIT;
PROC SORT data=work.mobpp3;
BY soc DESCENDING effective_date;
RUN;
DATA work.mobpp4;
SET work.mobpp3;
BY soc DESCENDING effective_date;
IF first.soc THEN OUTPUT;
RUN;
DATA RASHARE.GF_TEMP_MOBILITY_RC_JAN13 RASHARE.GF_TEMP_IPBB_RC_JAN13;
set work.mobpp4;
IF service_provider in ('ALL','MOBL')THEN OUTPUT RASHARE.GF_TEMP_MOBILITY_RC_JAN13;
ELSE OUTPUT RASHARE.GF_TEMP_IPBB_RC_JAN13;
RUN;
One technique is to have a permanent SAS control/progress tracking member which you would update after each key processing point, and then convert your SAS program to execute as a macro with %IF / %THEN %DO; %* your code goes here; %END; (condition code-piece execution) within the macro. And at the end, a successful completion would again update the SAS control/progress tracking member accordingly.
Scott Barry
SBBWorks, Inc.
There are options in SAS Batch programming to assign as part of command line that you can use to add checkpoints.
You need to run your programs in modes- Checkpoint mode and restart mode to help ease of operations.
Here are the options that you can use:
stepchkpt
steprestart
noworkinit
noworkterm
errorcheck
errorabend
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.