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 max(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;
Since you are using SQL pass through, this is not a SAS question really.
You should redirect this optimization inquire to forum specific for your source database.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.