BookmarkSubscribeRSS Feed
raveena
Obsidian | Level 7
Hi,

I have the dataset with the fields, the eff and exp fields are the date type.

ID comp grp eff exp
1 04 y 09/10/2010 08/12/2013
2 07 h 09/03/2009 07/02/2017

I need the report to looks like,

ID comp grp eff exp
1 04 y 20101009 20131208}
2 07 h 20090309 20170207}

Thanks in advance.
4 REPLIES 4
DBailey
Lapis Lazuli | Level 10
I think all you need to do is change the format of the date columns to yymmddn8. Do you need to add the "}" at the end of the second date?
raveena
Obsidian | Level 7
Hi DBailey,

Yes I need to } at the end of the field.
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
Use a DATA step approach and the PUT statement to generate the data-lines.

Scott Barry
SBBWorks, Inc.

Suggested Google advanced search argument, this topic / post:

data step put statement external file site:sas.com
yonib
SAS Employee
Hey,
You can use the proc format picture statment.
For Example:

data temp;
eff='09oct2010'd;
output;
eff='09mar2009'd;
output;
format eff ddmmyy10.;
run;

proc format;
picture date_t (default=11)
'01jan1950'd-'31dec2011'd='%0d%0m%Y}'
(datatype=date);
run;
data temp2;
set temp;
format eff date_t.;
run;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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