BookmarkSubscribeRSS Feed

Different date formats output code

Started ‎06-10-2014 by
Modified ‎10-05-2015 by
Views 918

data null;

d=put(month(today())-2,z2.);

if month(today())=1 then e=put(year(today())-1,4.);

else e=put(year(today()),4.);

f=e||d;

 

call symput('date',f); /201404/

call symput('info',put (today(),yymmddn8.)); /20140610/

run;

 

data null;

format dt date9.;

dt=input(put(&date.,6.),yymmn6.);/201404/

call symput('start',put(intnx('month',dt,1-12,'b'),date9.)); /01MAY2013/

call symput('rpt_dt',put(intnx('month',dt,0,'e'),date9.)); /30APR2014/

call symput('Rbase',put(dt,mmyyn6.)); /042014/

call symput('Rbase2',put(intnx('month',dt,0,'e'),yymmddn8.)); /20140430/

call symput('monyy',propcase(put(dt,monyy5.))); /Apr14/

run;

%put &start. &rpt_dt. &Rbase. &Rbase2 &monyy;

 

 

Output#

 

201404 20140610 01MAY2013 30APR2014 042014 20140430 Apr14

 

Version history
Last update:
‎10-05-2015 03:49 PM
Updated by:

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!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Labels
Article Tags