BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
1 ACCEPTED SOLUTION
21 REPLIES 21
Astounding
PROC Star

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.

Haikuo
Onyx | Level 15

Confused. Never seen this before. Care to elaborate more? Thanks, Haikuo

data_null__
Jade | Level 19

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

data class;
   set sashelp.class;
   *t = time();
   t =
'8:01';
  
run;
proc print;
  
format t-numeric-t time5.;
  
run;
Haikuo
Onyx | Level 15

Thanks for the explanation and specially,  the link. Did not know such things existed. Smiley Happy

Haikuo

data_null__
Jade | Level 19

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.

format t-numeric-t time5. t-character-t $5.;
sandyming
Calcite | Level 5

If in a macro:

   %if "vtype(&time)"="C" %then %do....

is this correct?

sandyming
Calcite | Level 5

why it is not correct? how about : if vtype(&tm)="N"?

sandyming
Calcite | Level 5

if the time variable is char, then do something;

if it is num, do something else....

sas-innovate-2024.png

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.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 21 replies
  • 5814 views
  • 4 likes
  • 7 in conversation