Hi All,
I am working on the number of ticket bookings of a flight.I have the different number of bookings in one day at different time points and I have written the below code.
proc sql;
create table new as
select date,sum(TOTAL_BOOKINGS_IN_CABIN) as neww from boo
group by date;
quit;
When I export this dataset called "new", then I am not getting the date column as in the date format (mm/dd/yyyy).It is giving as
date
41235
41236
.........
and so on.
I want the date as:
date
04/04/2014
02/05/2014
...... and so on.
Can someone pls help me on this?
Thanks in advance.
Sandeep
data _null_;
a=41235;
put a mmddyys10.;
run;
Hi Madam,
Thanks for the reply.I did not understand your code.The date has the format of : 04/04/2014...but when I export ,date format is different.
If I assign a=41235, then it's difficult to assign for all the values,right? Can you please elaborate your code?
Thank you,
Sandeep
First, I am sorry to tell you that I'm a Sir, and then I 'm wonder that where do you want to export? I can give you a example as follows:
data a;
a=1;
format a mmddyys10.;
run;
proc export outfile="C:\Users\Pactera\Desktop\test.txt" dbms=tab replace;
run;
And the results is as following:
So, you can see that the results' format is what you want.
How do you export?
Does your date have a format ?
proc sql;
create table new as
select date format=mmddyy10. ,sum(TOTAL_BOOKINGS_IN_CABIN) as neww from boo
group by date;
quit;
Hi friend,
Thanks for the reply.
Yes,the date has the format of : 04/04/2014......
I tried your code but it didn't work.I was exporting through the menu driven option(manually).
Please let me know if i miss something.
Export it to what ? CSV ,EXCEL ?
If it didn't work out.
Try to change date into character type variable :
Does your date have a format ?
proc sql;
create table new as
select '09'x||put(date,mmddyy10. -l) as d ,sum(TOTAL_BOOKINGS_IN_CABIN) as neww from boo
group by date;
quit;
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 how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.