BookmarkSubscribeRSS Feed
HitmonTran
Pyrite | Level 9

Hi,

 

I have to create a listing for raw AE (adverse events) data.  This listings need to be rerun everytime we have a new data.  I need to create a flag to identify old records(previous data) vs. new record(new data).  What would be the best way to create the flag?    

2 REPLIES 2
PeterClemmensen
Tourmaline | Level 20

Depends.. Show us your data?

Reeza
Super User
Create a view that has the data and include the reporting date/event date or date you enter it into the table. Then add a dynamic variable that's set if the maximum date is the date and set that to 1 or True or whatever you'd like.

proc sql;
create view want as
select *, case when report_date = max(report_date) then f "New"
else "Old" end as flag
from have;
quit;

Then report using the view, not the table. Or add that similar logic to your append process.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 826 views
  • 0 likes
  • 3 in conversation