Desktop productivity for business analysts and programmers

Comparing Dates from Netezza vs SAS

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 8
Accepted Solution

Comparing Dates from Netezza vs SAS

Hello,
I have read into SAS a Netezza table where one of the columns is a date ( The column type was date ) . 
Now I am trying to create several sub-tables in SAS, but I'm having trouble comparing dates in SAS.

Code to create first SAS dataset

proc sql;
   connect to netezza
   (server=xxxx database=xxxx  PORT = xxxx user=xxxx password="&mysaspasswd"
connection=global);
create table SASDATA.WEEKLY_REPORT_RT_LOAD as
select * from connection to netezza
   (select a.* from WEEKLY_REPORT_RT_LOAD a  order by 1,2);
run;

code for subtable

%let starttime = today() - 30;

proc sql;
create table sasdata.rtload_tab_1 as
select * from SASDATA.WEEKLY_REPORT_RT_LOAD

where marketdate >= &starttime;
run;

below is the picture of the column (variable) marketdate that i am trying to filter on.

Untitled.png

While the table is created. The data has not been filtered by the date as i would have thought.

As a matter of fact it is not being filtered at all.
Any help would be appreciated.

Thanks,
Tom


Accepted Solutions
Solution
‎06-06-2012 12:42 PM
Grand Advisor
Posts: 10,210

Re: Comparing Dates from Netezza vs SAS

From the displayed values of MARKETDATE it is a DATETIME variable and the STARTTIME you created is a DATE variable.

I would try modifying the sql to

where datepart(marketdate) ge &starttime;

View solution in original post


All Replies
Solution
‎06-06-2012 12:42 PM
Grand Advisor
Posts: 10,210

Re: Comparing Dates from Netezza vs SAS

From the displayed values of MARKETDATE it is a DATETIME variable and the STARTTIME you created is a DATE variable.

I would try modifying the sql to

where datepart(marketdate) ge &starttime;

Occasional Contributor
Posts: 8

Re: Comparing Dates from Netezza vs SAS

Thanks. That worked like a charm. Smiley Happy

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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