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;
Hi @Anandkvn
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.
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.