Help using Base SAS procedures

Forgot how to format a data

Accepted Solution Solved
Reply
Regular Contributor
Regular Contributor
Posts: 238
Accepted Solution

Forgot how to format a data

I have a table where the SAS dates for fst service and birthday are

      8    BIRTHDAY                Num       8    DATE9.    DATE9.      BIRTHDAY

I am trying to reformat in my proc sql as yyyymmdd

Here is my code and I am just drawing a complete blank

proc sql;*select distinct information;

create table sum0513 as

(select distinct

sys_id,

alt_id,

sub_nbr,

acct_nbr,

fst_srvc_dt format date=yymmdd8.,

first_name,

last_name,

bday format date=yymmdd8.,

age,

from tbl2

group by sys_id, fst_srvc_dt, acct_nbr);

run;


Accepted Solutions
Solution
‎05-01-2013 05:55 PM
Super User
Super User
Posts: 7,046

Re: Forgot how to format a data

fst_srvc_dt format=yymmddN8.,


The syntax is FORMAT= and then the format. YYMMDD8 will get you two digit years and hyphens.  The N in code above means to not use any separator, so there is room for four digit years.  You could also use YYMMDD10. if you like the separators.

View solution in original post


All Replies
Solution
‎05-01-2013 05:55 PM
Super User
Super User
Posts: 7,046

Re: Forgot how to format a data

fst_srvc_dt format=yymmddN8.,


The syntax is FORMAT= and then the format. YYMMDD8 will get you two digit years and hyphens.  The N in code above means to not use any separator, so there is room for four digit years.  You could also use YYMMDD10. if you like the separators.

Regular Contributor
Regular Contributor
Posts: 238

Re: Forgot how to format a data


Thanks. Brainfart day.

Super User
Posts: 11,343

Re: Forgot how to format a data

I think what you're looking for is;

fst_srvc_dt format=yymmdd8.,

or in a datastep

format fst_srvc_dt yymmdd8.;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 188 views
  • 3 likes
  • 3 in conversation