DATA Step, Macro, Functions and more

rename variable and amend date format in same variable

Accepted Solution Solved
Reply
Contributor
Posts: 20
Accepted Solution

rename variable and amend date format in same variable

Hi I have a column called SystemDate with a date format yymmdd8 and the date is being displayed  06-08-10 I would like to rename the column to Todaysdate and have the date format DDMMYY10 10/08/2006. How would I go about changing the format of the date?


Accepted Solutions
Solution
‎06-21-2017 08:46 AM
Super User
Posts: 7,809

Re: rename variable and amend date format in same variable

data want;
set have (rename=(systemdate=todaysdate));
format todaysdate ddmmyy10.;
run;

If your dataset is large and you do not need to preserve its original status, consider using proc datasets.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Super User
Super User
Posts: 7,970

Re: rename variable and amend date format in same variable

data want;
  set have (rename=(systemdate=todaysdate));
  format todaysdate ddmmyy10.;
run;
Frequent Contributor
Posts: 129

Re: rename variable and amend date format in same variable

[ Edited ]

Hi,

 

DATA have;
   systemDate="10AUG2006"d;
   format systemdate yymmdd8.;
RUN;

DATA want;
   SET have(rename=(SystemDate=Todaysdate));
   format Todaysdate DDMMYY10.;
RUN;
________________________

- Cheers -

Solution
‎06-21-2017 08:46 AM
Super User
Posts: 7,809

Re: rename variable and amend date format in same variable

data want;
set have (rename=(systemdate=todaysdate));
format todaysdate ddmmyy10.;
run;

If your dataset is large and you do not need to preserve its original status, consider using proc datasets.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
☑ This topic is solved.

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

Discussion stats
  • 3 replies
  • 155 views
  • 0 likes
  • 4 in conversation