BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
jenim514
Pyrite | Level 9

Hi,

 

I have a dataset with multiple timepoints in each observation (eg.  lbtim1 lbtim2 lbtim3...).  They are all in time5. numeric format.

How can I change all of these to character format (TOD5.)?

 

All of the time variables have the same prefix 'lbtim'  with the timepoint.  Here is what I started with:

 


data prsupp;
set db.lbi;

array timn (*) lbitim:;
array timc (*) lbtimc:;
do i= 1 to dim (timn);
if ~missing (timn(i)) then timc(i)=put(timn(i),tod5.);
end;
run;

 

 

I guess it's something with the new character variables I'm trying to create.  Or can I just overwrite the numeric variables to character somehow?

 

Help is appreciated!

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

Why do you need to convert your time variables to character? You can assign the TOD5. format to them without converting. 

View solution in original post

2 REPLIES 2
novinosrin
Tourmaline | Level 20

 

array timc (*) lbtimc:;   This is a new assignment, so if i am right, you can't use var lists

 

rather array timc (count of lbtimb)

SASKiwi
PROC Star

Why do you need to convert your time variables to character? You can assign the TOD5. format to them without converting. 

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 609 views
  • 0 likes
  • 3 in conversation