There is a table with a uniqe ID. This is an external time stamp table (yymmdd).I'd like to check if a fields (in the previous month) A colums, B columns and C columns have changed on the same ID in this table then we will update field in the new table e.g: D:='Y'. If the table does not exist then do not nothing.
Thanks!
You can use a data step update:
data new;
update
have190430
have190331
;
by id startdate enddate;
run;
Run a proc compare in a
%if %sysfunc(exist(datasetname)) %then %do;
%end;
block.
Thanks, but how can i define a column value to the new dataset based on these result? I shows the diff but how can i use it to in a data set to add the flg value to 'Y'
e.g:
data have190430;
input ID (Startdate Enddate)(:date11.) Name $ Flg $;
format Startdate Enddate date11.;
datalines;
1 26-Sep-13 26-Sep-13 Erloti n
2 23-Oct-13 23-Oct-13 AAAAAA n
3 22-Nov-13 22-Nov-13 Erloti n
4 16-Dec-13 16-Dec-13 Erloti n
;
run;
data have190331;
input ID (Startdate Enddate)(:date11.) Name $ Flg $;
format Startdate Enddate date11.;
datalines;
1 26-Sep-13 26-Sep-13 Erloti n
2 23-Oct-13 23-Oct-13 Erloti y
3 22-Nov-13 22-Nov-13 Erloti n
4 16-Dec-13 16-Dec-13 Erloti n
;
run;
You can use a data step update:
data new;
update
have190430
have190331
;
by id startdate enddate;
run;
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.
Ready to level-up your skills? Choose your own adventure.