BookmarkSubscribeRSS Feed
nitin_k24
Calcite | Level 5

I have a variable name Losstime which has date with time stamp

My scenario is

if losstime in between  4pm 29jan2011 (Here 4pm inclusive) to 4pm29jan2012 (Here 4pm is exclusive ) then the variable

Policy year  = 2011/12 (Variable need to create as per the scenario)

if losstime in between  4pm 29jan2010 (Here 4pm inclusive) to 4pm29jan2011 (Here 4pm is exclusive ) then the variable

Policy year  = 2010/11 (Variable need to create as per the scenario)  etc...

Please help me with Sas and Sql code.

4 REPLIES 4
LinusH
Tourmaline | Level 20

Is this a one time ad-hoc update?

Just use SQL update, with a set statement combined with a where clause.

Be sure that you use SAS date and datetime constants (if your data is stored correspondingly).

Data never sleeps
nitin_k24
Calcite | Level 5

Hi,

Losstime variable has lakhs of records. Date, month, year, time varies for every record.

Please suggest..

LinusH
Tourmaline | Level 20

Don't understand, if your requirement differ from your example, give us some more flesh (example data that is)...

Data never sleeps
LinusH
Tourmaline | Level 20

Sorry, now I get it!

Well, I should build a lookup-up table, containing your start and end datetime, for each policy year. Then you fetch the policy year in a join, or you could define the interval as a format, with the policy year as label (the formatted value).

Data never sleeps

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!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 4 replies
  • 1690 views
  • 0 likes
  • 2 in conversation