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. 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 888 views
  • 0 likes
  • 3 in conversation