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;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: