06-02-2016 05:43 AM
I'm having a little challenge on reading some rows from an zos DB2 using SAS-PROCSQL .
How do I code my SAS to select on date from the DB2 database :
In this particular case the date is variabel KMG_CREATE_DATE , se below desc..
DB2 variabel/column : KMG_CREATE_DATE 10 DATE 4
eg in below code I would want to select on "db2 date" being e.g 20160101 and/or 'similar '01JAN2016'
but as it it wrtitten here it does NOT work .. !!!
LIBNAME MYLIB DB2 SSID=&USSID. SCHEMA=&CREATOR.;
CREATE TABLE WORK.UKDS2 AS
( KMG_KNO LIKE '0554-E%' OR
KMG_KNO LIKE '0393-P%' OR
KMG_KNO LIKE '0582-E%') AND
KMG_CREATE_DATE >= db2 date
thnak you in advance :-)
06-02-2016 08:42 AM
Since you are not using a passthru query, the db2 dates are converted into SAS dates (or, perhaps, datetime variables) and you can manipulate them in SAS just like other SAS dates.
I would suggest that you start by doing a simple SAS listing of a few rows to see what the data look like to SAS and modify your query from there.
06-03-2016 07:09 AM
tks for your prompt answer ... I think i know what you mean, basically access the KMG_CREATE_Date i a later raw SAS step
which might also be a good idea. But what i did not write perhaps was that I was thinking about being able to passthrough a data to DB2 in the proc sql which can be used to limit the amount of rows extracted from DB2 ..
e.g build a macro variable with a call symput ,a nd then use that macro variable in the proc sql to passthrough to DB2
to limit the amount of returned rows.
first build tha variable "db2_date" :
then in the proc sql
kmg_create_data => &INT_DATE
but i cannot get it to work :-(