Help using Base SAS procedures

put-input

Accepted Solution Solved
Reply
Super Contributor
Super Contributor
Posts: 440
Accepted Solution

put-input

hi guys.

When trying to convert this number x=123199  to a date using format date9. i get 4/22/97 but if i use the put + input functions i get different results :

x=123199 ;

xchar = put(x,z6.) ;

xdate = input (xchar, mmddyy6.) ;

format xdate date9. ;

so xdate=31/dec/99 in this case.

So how come?


Accepted Solutions
Solution
‎03-27-2013 01:14 PM
Respected Advisor
Posts: 4,641

Re: put-input

Hi,

The string "123199" is read like the date 12/31/99 whereas the number 123199 is the number of days between 01JAN1960 and 22APR2297, which is the date you get when converting 123199 into a date.

PG

PG

View solution in original post


All Replies
Solution
‎03-27-2013 01:14 PM
Respected Advisor
Posts: 4,641

Re: put-input

Hi,

The string "123199" is read like the date 12/31/99 whereas the number 123199 is the number of days between 01JAN1960 and 22APR2297, which is the date you get when converting 123199 into a date.

PG

PG
Super Contributor
Super Contributor
Posts: 440

Re: put-input

right right,did not think of it!

Thanks so much

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 169 views
  • 2 likes
  • 2 in conversation