using Code in a Data step...
OK, now here's a harder question. How do you do it in a PROC step? For example, if T is character, it should be printed without a format. But if T is numeric it should be printed in the TIME5 format. Hint: macro language is not needed. All of the necessary code can be hard-coded within the PROC step. If nobody gets the answer, I'll post it tonight.
It this right?
format t-numeric-t time5.;
Bingo! Good job.
The "SAS Variable List" big medicine.
Confused. Never seen this before. Care to elaborate more? Thanks, Haikuo
It means for all the variables between t and t that are numeric associate format time5. If there are none when t is character nothing happens.
SAS(R) 9.3 Language Reference: Concepts, Second Edition
Thanks for the explanation and specially, the link. Did not know such things existed.
Haikuo
Just to make it more complete we can also format the character name range T, that may or may not exist. The "SAS Variable List" is one of the most powerfull parts of the SAS language.
If in a macro:
%if "vtype(&time)"="C" %then %do....
is this correct?
No
why it is not correct? how about : if vtype(&tm)="N"?
What are you trying to do?
if the time variable is char, then do something;
if it is num, do something else....
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!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.