proc sql;
create table cust_orders(ord_no num(8),purch_amt num(10,2),ord_date num format=yymmdd10.,customer_id num(6),salesman_id num(6));
insert into cust_orders values (70001 , 150.5 , '2012oct05'd , 3005 , 5002);
insert into cust_orders values (70009 , 270.65 , '2012sep10'd , 3001 , 5005);
insert into cust_orders values (70002 , 65.26 , '2012oct05'd , 3002 , 5001);
insert into cust_orders values (70004 , 110.5 , '2012aug17'd , 3009 , 5003);
quit;
The date should be entered like this: 'DDmonYYYY'd
e.g.
'05oct2012'd
You can also simplify you code as follows (by using 1 INSERT INTO statement)
proc sql;
create table cust_orders(ord_no num,purch_amt num, ord_date num format=yymmdd10.,customer_id num,salesman_id num);
insert into cust_orders
values (70001 , 150.5 , '05oct2012'd , 3005 , 5002)
values (70009 , 270.65 , '10sep2012'd , 3001 , 5005)
values (70002 , 65.26 , '05oct2012'd , 3002 , 5001)
values (70004 , 110.5 , '17aug2012'd , 3009 , 5003);
quit;
NB: PROC SQL enables you to specify a column width for character columns but not for numeric columns.
SAS date literals must be in the appearance of something displayed using the SAS DATE. format.
Examples:
Date7.: 'ddMONyy'd
Date9.: 'ddMONyyyy'd
Date11.: 'dd-MON-yyyy'd
@ballardw wrote:
SAS date literals must be in the appearance of something displayed using the SAS DATE. format.
Examples:
Date7.: 'ddMONyy'd
Date9.: 'ddMONyyyy'd
Date11.: 'dd-MON-yyyy'd
Or more accurately something that the DATE **informat** can read.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.