Hi All!
Im trying to work with some Covid data and having a hard time parsing out New Cases. Now the data has an instance for each date (FNDate) with the "Cofirmed" value of cases. The next instance the Confirmed value is the previous day plus new cases. It is additionally tricky because there is an istance for each country for each day so it needs it by country. I've attached an output (first 10 instances) of the file for column names.
Any thoughts would be super helpful!
What is the question here?
Are you trying to take the difference between the current value and the previous value? If so use the DIF() function.
Try something like this (make sure the data is sorted first).
data want;
set have;
by country date ;
new_cases = dif(cases);
if first.country then new_cases=cases;
run;
What is the question here?
Are you trying to take the difference between the current value and the previous value? If so use the DIF() function.
Try something like this (make sure the data is sorted first).
data want;
set have;
by country date ;
new_cases = dif(cases);
if first.country then new_cases=cases;
run;
Thank you! This worked perfectly!
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.