I have this table, that I use to track when my code runs, and how many times it has been run for the same snapshot date: data run_table;
snpst_dt = &dt;
run_ts = datetime();
format run_ts ts_format.;
run_id = 1;
run; So, if you run it twice for a snapshot date, there should be two run_ids (1 and 2). If you run it for the first time for a certain snapshot date, then the run_id should be 1. I am trying to this conditionally with the following code: data run_table_temp;
set run_table(where=(snpst_dt=&dt));
if snpst_dt = &dt then run_id +1;
else do;
snpst_dt = &dt;
run_ts = datetime();
format run_ts ts_format.;
run_id = 1
end;
run; If I run the above for an existing snapshot date, then the run_id indeed incremented, but if I run it for a snapshot date, that does not already exist, then I get 0 rows, instead of the expected new row (the "else do" part). What am I missing? Does it have something to do with the output statement?
... View more