BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
iwiebos04
Calcite | Level 5

proc sql;
create table slc.NEWSYS_201610_1 as
select *
from Slc.NEWSYS_201610
where Open_DT between "01Jan2019"d and "31JAN2020"d;=

(select Open_DT between "01Jan2019"d and "31JAN2020"d ;
Open_Date = datepart(Open_DT)

format Open_DT datetime. Open_Date date9);

run;

 

above is my query 

Below is the error message.

Please what am i doing wrong. I am new to SAS

 

NOTE: Table SLC.NEWSYS_201610_1 created, with 0 rows and 72 columns.

34 ! =
_
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

35
36 (select Open_DT between "01Jan2019"d and "31JAN2020"d ;
NOTE: PROC SQL set option NOEXEC and will continue to check the syntax of statements.
37 Open_Date = datepart(Open_DT)
_________
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

38
39 format Open_DT datetime. Open_Date date9);

 

1 ACCEPTED SOLUTION

Accepted Solutions
PGStats
Opal | Level 21

Correct syntax:

 

proc sql;
create table slc.NEWSYS_201610_1 as
select 
	*, 
	datepart(open_dt) as open_date format=date9.
from Slc.NEWSYS_201610
where datepart(Open_DT) between "01Jan2019"d and "31JAN2020"d;
quit;
PG

View solution in original post

2 REPLIES 2
PGStats
Opal | Level 21

Correct syntax:

 

proc sql;
create table slc.NEWSYS_201610_1 as
select 
	*, 
	datepart(open_dt) as open_date format=date9.
from Slc.NEWSYS_201610
where datepart(Open_DT) between "01Jan2019"d and "31JAN2020"d;
quit;
PG
iwiebos04
Calcite | Level 5

Thanks a lot.

 

SAS Innovate 2025: Call for Content

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!

Submit your idea!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 536 views
  • 0 likes
  • 2 in conversation