# Posts Tagged ‘ dates ’

## dates in datetime fields

September 22, 2011
By

Got date values intermingled with datetime values? Here’s a brute force way to convert the date values into date time values. Code data _null_; x1='01JAN1960:05:09:56'dt; x2='12SEP2010:00:00:00'dt; array x(*) x:; ...

Tags: ,
Posted in SAS | Comments Off

## Month of Quarter variable

February 8, 2011
By

quick formula to calculate the month of the quarter (JAN, APR, JUL, OCT=1; FEB, MAY, AUG, NOV=2; MAR, JUN, SEP, DEC=3). moq=mod(month(date-value)-1,3)+1; note this is completely poached from an old excel formula. here’s the formula in action: data ...

Tags:
Posted in SAS | Comments Off

## prxparse(dates)

February 4, 2010
By

suppose i’ve got some odd character dates defined as follows: d1='29-31 DEC 2009,04-05 JAN 2010'; *broken across month, year; d2='04-05,08-09,11-12 FEB 2010'; *broken within month; d3='01-03 MAR 2010'; *contiguous within month; d4=...

Tags: , ,
Posted in SAS | Comments Off

## prxparse(dates)

February 4, 2010
By

suppose i’ve got some odd character dates defined as follows: d1='29-31 DEC 2009,04-05 JAN 2010'; *broken across month, year;d2='04-05,08-09,11-12 FEB 2010'; *broken within month;d3='01-03 MAR 2010'; *contiguous within month;d4='31...

Tags: ,
Posted in SAS | Comments Off

## an mmddyyyy hhmmss informat. kinda.

October 20, 2009
By

a while ago, i took the hack shortcut of reading character datetime stamps into datetime values. i even went so far as suggesting a regex would be a better solution. well, here’s that better solution: data mmddyyyy_hhmmss_xm; if _n_=1 then do; ...

Tags: , , , , , ,
Posted in SAS | Comments Off

## an mmddyyyy hhmmss informat. kinda.

October 20, 2009
By

a while ago, i took the hack shortcut of reading character datetime stamps into datetime values. i even went so far as suggesting a regex would be a better solution. well, here’s that better solution: data mmddyyyy_hhmmss_xm; if _n_=1 then do; re...

Tags: , , , , ,
Posted in SAS | Comments Off

## random dates

July 16, 2009
By

this is a cross posting from this sas discussion forum. assuming you know the min and max of allowable dates (01jan2005 - 30jun2009, for example), you can use random functions. data randates; mindate='01jan2005'd; maxdate='30jun2009'd; range = max...

Tags: , , , ,
Posted in SAS | Comments Off

## random dates

July 16, 2009
By

this is a cross posting from this sas discussion forum. assuming you know the min and max of allowable dates (01jan2005 - 30jun2009, for example), you can use random functions. data randates; mindate='01jan2005'd; maxdate='30jun2009'd; range = m...

Tags: , , ,
Posted in SAS | Comments Off

## Proc-x is looking for sponsors!

Dear readers, proc-x is looking for sponsors who would be willing to support the site in exchange for banner ads in the right sidebar of the site. If you are interested, please e-mail me at: [email protected]

## Welcome!

SAS-X.com offers news and tutorials about the various SAS® software packages, contributed by bloggers. You are welcome to subscribe to e-mail updates, or add your SAS-blog to the site.

## Recent Posts

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration.