BookmarkSubscribeRSS Feed
Lorenzom
Calcite | Level 5

Dear all,

I am going crazy with this problem.

I want to generate a number starting from a date and a string like 2456701

I want to obtain a decimal number like xxxxxx,2456701 where xxxx is the difference between a date and a threshold

length threshold date_formatted site_factor 8.;

threshold = put(input('01JAN2000:00:00:00.000', DATETIME22.3),8.);
date_formatted = put(vardate, 8.) ;
site_factor = date_formatted - treshold;
                      
                       site = site_factor + pno*0.0000001;

the pno is 2456701 but I obtain a number like 234534.245670
Any help will be very appreciated. 🐵
Thank you
L.
3 REPLIES 3
data_null__
Jade | Level 19

Your code that use PUT function and then takes different of the two character values makes no sense to me.

I don't think you can have the accuracy you seek with 8 byte floating point numeric for SITE.  You can make it character.

Perhaps using something like this, after you fix the calculation of SITE.

length site $20;  maybe

site = catx(',',site_factor,pno);

Tom
Super User Tom
Super User

Why are trying to subtract the two character variables you created with the PUT() function call?

Also there are about 480 million seconds between the beginning of the century and now.

Perhaps you can use minutes or days instead to get a smaller number?

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 Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 778 views
  • 0 likes
  • 4 in conversation