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!
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: