I am trying to add some new rows to an existing data file using proc sql/insert into. As you can see from the data format that the dates are in MMDDYY format. When I am inputing 120111 (12 January 2011) in the values statement I am getting this "11/07/2288" in the output which clearly wrong. I want to know what is the right way to specify the "date" in this situation ? Attached the code and the data file below. My data set looks like this I am trying to insert 4 new rows using following code data work.sales_data2;
set work.example;
run;
proc sql;
insert into work.sales_data2
VALUES(120111,120111,1244118000,11100,"Orange_Juice", 2,4,32.80)
VALUES(120211,120211,1244118001,11101,"Chocolate",3,2,18.20 )
VALUES(120311,120311,1244118002,11102,"Candy",1,5,3.00 )
VALUES(120411,120411,1244118003,11103,"Orange_Juice",1,5,35.00 );
quit; The output looks like this . But the date is not showing the desired format- which is supposed to be 12/01/11 ----------------------------------------------------------- Updating the post with final solution. Find the code below. (Thanks to KurtBremser) data work.sales_data2;
set work.example;
format Order_date mmddyy10.;
format Delivery_date mmddyy10.;
run;
proc sql;
insert into work.sales_data2
VALUES("01dec2011"d,"01dec2011"d,1244118000,11100,"Orange_Juice", 2,4,32.80);
quit; The correct steps to follow are: 1. check the format of date values (in the original data set) using describe table 2. use format statement within the data step to ensure the new value added will be in proper format. 3. finally, use date literal (with quotation and d at the end) in your values statement to ensure that the dates are read properly.
... View more