Hello, I need to create a macro that adds a variable equal to one to a dataset, and then sum the counts of that variable and merges it to another dataset. I need to do this for datasets corresponding to the years 2004 through 2018. The structure of the data set names are "rp_equities_2004", "rp_equities_2005"...etc. I have attached code to this message with what I currently have. I know it is not correct but I was hoping someone could point me in the right direction. It's difficult because the files I am working with are massive, so simply running a check is difficult to do. Here is my current code: %macro raven; %do i = 2004 %to 2018; data rp_equities_i; set rp_equities_i; article = 1; run; proc sql; create table media_cov_i as select distinct a.*, b.count(article) as article_count_rel from media_cov_(i-1) as a left join rp_equities_i as b on a.rp_entity_id = b.rp_entity_id and a.datadate <= b.rpna_date_utc <= b.datadate_lead and b.relevence > 75; quit; %end
... View more