Hello,
I want to set some dates to missing. I've tried two ways, based on the documentation below.
http://support.sas.com/onlinedoc/913/getDoc/da/lrcon.hlp/a001292604.htm
First Attempt:
data Pt08;
set LDL0809;
Year = 2008;
if year(datepart(Date)) ne 2008 then Date = . and Value = .;
Second Attempt:
data Pt09;
set LDL0809;
missing X;
Year = 2009;
if year(datepart(Date)) ne 2009 then Date = X and Value = .;
What is happening is that instead of being truly missing, it seems that Date is set to the SAS date value of 0, mean it is showing up as 01JAN1960:00:00:00.
If it helps, my goal is that I have a bunch of data where I have the date (Date) and the value of the measurement taken on that date (Value). A Example of the type of data I have:
PtID Date Value
15 4/15/08 92
15 5/19/09 106
16 8/12/08 84
17 10/7/09 127
However, I need to find the percent of patients for whom a measurement was taken on a yearly basis. So I want to create "missing" dates/values for any year that the measurements were not taken, so that I can work with the data more easily. Like this:
PtID Date Value Year
15 4/15/08 92 2008
15 5/19/09 106 2009
16 8/12/08 84 2008
16 . . 2009
17 . . 2008
17 10/7/09 127 2009
But, as explained above, anytime I try to set the dates to missing, I get 01JAN1960:00:00:00.
What I am missing?!
Thanks!