@purvaj wrote: Thank you I will try this out! The end goal is to get proc stdrate functioning. The procedure wants datasets have the same exact strata regardless of whether the age strata within the dataset that is getting standardized has cases in each stratum. When I ran my code and datasets on another computer it worked fine. SAS knew to skip those strata in the standardization process that did not exist.
So your problem is not with the SQL left join (which, as proven, works as it should), but with the ability of proc stdrate to deal with missing values.
You can deal with that in the SQL by taking care of the situation yourself:
proc sql;
create table num2 as
select
a.*,
case
when b.agecat is missing
then '1.1' /* set a default value that works for your analysis "/
else b.mssa_id
end as mssa_id,
/* do similar for the rest of the columns you want */
from stdpop a left join num b
on a.agecat = b.agecat
order by b.mssa_id, a.agecat;
quit;
... View more