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....
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.