Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date to Text

Status
Not open for further replies.

shenniko

Programmer
Apr 15, 2005
52
US
Hi,

Need some help..

Ive got a Dataset with a few variables, one of them being a Date field, and another one being a Temperature.

What i want to do is combine the Date and the temp field in a text variable..

So at the moment the Date field is shown as Date9. (02Jul2005)

So when i try combining the two fields together

E_Date = Entry_Date||' - '||Temperature;

it comes out like

16619 - 17.5

How do i get it to output 02Jul2005 - 17.5

Thanks in advance

Shenn
 
Use the PUT function.

Code:
E_Date = trim(put(Entry_Date,date9.))||' - '||Temperature;

FYI - You should use this function when converting a numeric variable to a text string. This way the sas WARNING is eliminated in the log file.
Klaz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top