Hi,
Could you help me figure out why I am getting this note??? after using the following lines of code???
Also can I use the code like this????
872 if Admission=0 and intck('year',Birth_Date2,ADMIT_DATE1) gt 1 then AgeAtAdmission=intck('year',Birth_Date2,ADMIT_DATE1);
873 if intck('year',Birth_Date2,ADMIT_DATE1) lt 1 then AGEDAY=ADMIT_DATE1-Birth_Date2;
NOTE: Missing values were generated as a result of performing an operation on missing values.
Each place is given by: (Number of times) at (Line):(Column).
65 at 873:4 65 at 873:70
NOTE: There were 14178 observations read from the data set WORK.FINAL.
Thanks
this is it :
data test;
informat Birth_Date2 Admit_date1 date9.;
format Birth_Date2 Admit_date1 date9.;
input Admission Birth_Date2 Admit_Date1;
var1 = intck('Year' , BirthDate2, Admit_Date1);
if Admission = 0 and var1 > 1 then AgeAtAdmission = var1;
else AgeDay = intck('day', BirthDate2, Admit_date1);
drop var1;
cards;
1 15apr1980 .
0 15apr1980 20jun1985
0 10jul2000 22aug2010
0 15may2010 15jun2010
;
run:
You have missing values for some of either Birth_Date2, Admit_Date1 or both. Run Proc Freq on those variables and see how many of each.
This note let you know about the missing values that were created.
for example check this 4. Missing values in assignment statements . It give you an example with details about this note.
If you're only going to have an admit_date1 if someone has a value of 0 for admission then you have to account for that fact.
My question: why calculate two different variables for those above and below 1 year old when you could capture both with something like:
data have;
informat Birth_Date2 ADMIT_DATE1 date9.;
format Birth_Date2 ADMIT_DATE1 date9.;
input Admission Birth_Date2 ADMIT_DATE1;
if admission eq 0 then AgeAtAdmission=YRDIF(Birth_Date2,ADMIT_DATE1,'age');
cards;
1 15apr1980 .
0 15apr1980 20jun1985
0 10jul2000 22aug2010
0 15may2010 15jun2010
;
Hi Art,
Thanks for the help.
The sas code requires the input file to have the new variable(ageday) created if age is less than an year.
I now understand that the "note" is because of some missing dates....
Is there any better way to recode the following.
872 if Admission=0 and intck('year',Birth_Date2,ADMIT_DATE1) gt 1 then AgeAtAdmission=intck ('year',Birth_Date2,ADMIT_DATE1);
873 if intck('year',Birth_Date2,ADMIT_DATE1) lt 1 then AGEDAY=ADMIT_DATE1-Birth_Date2;
Thanks
You should put
intck('year',Birth_Date2,ADMIT_DATE1)
in a variable (so sas doesn't have to calculate 3 times the same thing + it reads better)
fe.
var1 = intck('year',Birth_Date2,ADMIT_DATE1);
if var1 > 1 then AgeAtAdmission = var1;
else AgeDay = intck('day', ADMIT_DAT, Birth_Date2);
Thanks Bart,
For helping me use the code efficiently.
I also wanted to know if the result would be the same both ways(with what u showed and what I have done prior)
Thanks
this is it :
data test;
informat Birth_Date2 Admit_date1 date9.;
format Birth_Date2 Admit_date1 date9.;
input Admission Birth_Date2 Admit_Date1;
var1 = intck('Year' , BirthDate2, Admit_Date1);
if Admission = 0 and var1 > 1 then AgeAtAdmission = var1;
else AgeDay = intck('day', BirthDate2, Admit_date1);
drop var1;
cards;
1 15apr1980 .
0 15apr1980 20jun1985
0 10jul2000 22aug2010
0 15may2010 15jun2010
;
run:
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.