When you say "display the attribute of the variable", what exactly do you mean? Can you give me an example of an attribute you want to display? Are you talking about the format of the variable, or the length of the variable? The attrn() function returns the value of a numeric attribute, so with the nobs atrribute name parameter it will give you the number of physical observations. I think you may want to look into the contents procedure and limit the output to the variable you want and the different "attributes" of the variable you are looking for.
proc contents data=comp.answer noprint
out=answer_contents;
run;