Hi all I am trying to run a query off another query. Here is an example without attaching the VERY long query. I ran a query using this criteria: /** MACROS **/ %LET RANGEBEG = '2019-01-01'; %LET RANGEEND = '2019-07-31'; %LET PAIDRANGE = '2019-07-31'; %LET CODE = svc.BILL_SVC_UNIT_1_CD IN ('92002','92004','92012','92014'); %LET CODE2 = svc.BILL_SVC_UNIT_2_CD IN ('0920'); %LET PAID = svc.CL_SVC_INTL_MSG_1_DSC LIKE 'PAY%'; /**END MACROS **/ PROC SQL; CONNECT to teradata as td ( tdpid='pg' mode=teradata); create table First AS select * from connection to td ( SELECT MEMNO ,DATE ,DATA ,DATA ,DATA FROM (My Database) WHERE (MY INFO) ); quit; data Final; set First; **** THIS SET CREATES THE COMBO COLUMN ****; COMBO = trim(left(MEMNO))||trim(left(BEGDATE)); PROC SQL; CREATE Table Results as SELECT Distinct* FROM First QUIT; I got the data that I wanted, now what I wanted to do is get a list of all the distinct COMBO's in the data so I ran this: PROC SQL; CREATE Table Results2 as Select Distinct COMBO From RESULTS; QUIT; This gave me the list of distinct COMBO’s. Now I want to go back into the database and pull all other lines that uses that same COMBO that DOES NOT include whats in the macros from above, but the column COMBO doesn’t exist in the database. I hope this makes sense and any help on this would be greatly appreciated. Thanks
... View more