Forum Discussion

Bahar909's avatar
Bahar909
Copper Contributor
Feb 05, 2021

grouping the data while extract it from database by where clause

Hi.

I want to extract the most recent date from my data in each group. It's easy when I have a table ready. But when I want to extract from my metadata it doesn't work. especially with a where clause. My data is tooooooooo big. So I can't extract everything and then group it. Please help me. I used maximum (qtm.kalenderday) for the last data.

PROC SQL;
	CONNECT TO ODBC AS mycon (datasrc=DMA_P);
	CREATE TABLE work.Company AS

	select *
		FROM CONNECTION TO mycon 
			(SELECT	
				qtm. Day,
				qtm. NR,
				qtm.name,
                qtm.kalenderday,
                qvm.WGnumber
				
			FROM dmameting_tr qvm,
				dm_ameting qtm,
				dmameting_wh WiK
		
			where
				qtm.qtmunitnr = WiK.meetunitnr
				and qtm.unitnr = qvm.unitnr 
				and qtm.meettijdstip_dt = qvm.meettijdstip_dt
				and max(qtm.kalenderday)
                group by qvm.WGnumber
			);
run;

DISCONNECT FROM mycon;
QUIT;

 

No RepliesBe the first to reply