BookmarkSubscribeRSS Feed
raveena
Obsidian | Level 7

Hi ,

Currently am having the date field EFFDAT and it displaying as


                          10012010
                          9012010


and its  type is 'number' and format is 'BEST12.' AND informat is 'BEST32.'

I need to display it as 20101001

                                20100912

Please let me know.

Thanks,

5 REPLIES 5
art297
Opal | Level 21

Would something like the following suffice?

data have;

  format datefield best12.;

  format datefield best12.;

  input datefield;

  cards;

10012010

9012010

;

options datestyle=mdy;

data want;

  set have;

  format datefield yymmddN8.;

  datefield=input(put(datefield,best12.),anydtdte.);

run;

vrmkool
Calcite | Level 5

you can use something like this :

data x;

input dt ;

cards;

10012010

9012010

;

run;

data y;

set x;

  dt1 = input(put(dt,z8.),mmddyy8.);

  format dt1 date9.;

run;

ArtC
Rhodochrosite | Level 12

I would change your format to yymmddN8. so that the value will display in YYMMDD form without any separators between YY and MM and DD.

Note that these solutions are storing a SAS date.  This is different than storing the numeric value of 20100901.

art297
Opal | Level 21

Art,  The format I suggested (i.e., yymmddN8.) also displalys without any separators.

ArtC
Rhodochrosite | Level 12

Art,

You are correct.  I was obviously not paying attention.

Art

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