I have a date field that is defined as character(MMDDYYCC).
Example: 11301220(Novermber 30th, 2012)
Could anyone please help me to convert this to CCYYMMDD in Numeric value?
The result should look like this: 20121130.
The reason why I need this in Numeric value is to sort this data.
Thank you for your help in advance!!
Try this:
data have;
input date$12.;
date1=input(cats(substr(date,1,4),substr(date,7,2),substr(date,5,2)),mmddyy10.);
format date1 yymmddn8.;
cards;
11301220
12011221
;
proc print;run;
Haikuo
Hi Haikuo,
Thank you very much for the prompt response. I really appreciate it.
The thing is I'm completely new to SAS Enterprise Guide pr SAS and I was trying to use your code in the "Computed Columns" like this:
input(cats(substr(date,1,4),substr(date,7,2),substr(date,5,2)),mmddyy10.):
format date yymmddn8.:
And it gave me an error.
Would it be possible for you to tell me how I can do this in the Enterprise Guide screen?
Thank you very much!!
sorry. I am among those old school SAS programmers who are NOT the targeting populations of EG. I have never used EG myself even I know it has been installed on my pc. I am sure someone on the forum with EG experience will surely come to rescue.
On a side note, if you have posted your question on EG board, I would probably have never responded.
Good Luck,
Haikuo
Hai.kuo,
Thank you for the info.
I didn't realze that there is a separate forum for SEG.
I really appreciate your help!!
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.
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.