Hi everyone.
I am establishing a program to check missing data points based on a set of "if" statements, and I need to generate a "Comment" column to indicate which variables are missing. But I stuck right at the beginning of the program.
Consider that I have a set of demographic characteristics (like age, day/month/year of birth, day/month/year of visit, height, weight, ...) and if a variable is missing, I need to add a string like "Missing age" (for example) into the "Comment" column. If all variables are not missing, "Comment" column is expected to be blank.
The way I think is that, I will use CAT function to add a new string into "Comment" column if a variable meet the missing condition like:
if AGE = . then Comment = cat(Comment,"Missing Age"); if BRTHDY = " " then Comment = cat(Comment,"Missing Birth date"); if BRTHMO = " " then Comment = cat(Comment,"Missing Birth month"); if BRTHYR = " " then Comment = cat(Comment,"Missing Birth year");
But after running the data step, the "Comment" column is blank. I can only think that I need a way to pre-define one value of "Comment" column before the "IF" statements.
Could anyone please give me an idea to deal with this situation ?
Thank you
... View more