When it says in your log that "Age is uninitialized" what that means is that the variable "Age" does not exist in the dataset. I don't know why the LOG always shows this note in blue, when it seems to me that it should be in big bold red letters, but so be it. It is a problem because any calculations that you attempt on based on "Age" will result to missing (because there is no age...). In the example you posted above, it appears that the problem is because you're writing over the same dataset twice. (Although, as Linlin points out, it's a little hard to tell because your LOG notes reference a different dataset than what the code references...) So ignoring the LOG notes that reference HOMEWRK2.BONE, what I see is: data test; <--- you create a dataset WORK.TEST set homewrk2.test; <--- It is based off of HOMEWRK2.TEST age=int((dov-dob)/365.25); <--- You create a new variable in WORK.TEST called "AGE" run; data test; <--- You again create a dataset WORK.TEST, essentially writing over everything you just did. set homewrk2.test; <--- This is also based off of HOMEWRK2.TEST, ignoring everything you just did. if age < 12 then agegrp=1; <--- SAS freaks out because HOMEWRK2.TEST does not have a variable called "AGE" else if 12 <= age < 20 then agegrp=2; else if age >=20 then agegrp=3; run; <--- The end So instead, try this: data test; set homewrk2.test; age=int((dov-dob)/365.25); if age < 12 then agegrp=1; else if 12 <= age < 20 then agegrp=2; else if age >=20 then agegrp=3; run; <--- The end
... View more