Hello
I had a question with my query, but I am generating a sas dataset and I have 3 variables out of 10 that are becoming missing for some rows. (AYB modality, engage date, and trigger date) Im not sure if a solution or resolution can come without a code, but these three values are coming up as missing in some rows in the code, while the name, dob, and Account name and all other values are showing up. Is there a way to retrive these missing values? Or are they just missing.
Thanks
Rida
When you have a left join, all observations from the "left" dataset will be included; if some of those have no match in the "right" dataset, the variables from there will be set to missing.
Post the input dataset(s) for the query (use a datastep as described in https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...), and the query code.
How are we supposed to help with your data and/or code if we know neither?
Well my query is below, but was just asking the question in a general sense
proc sql inobs=max outobs=max;
create table work.modality as
select distinct a.ayb_id,
a.type as AYB_MODALITY format=$15.,
a.activity_dt as AYB_MOD_ENG_DT format=mmddyy10.,
a.activity_dt as TRIGGER_DATE format=mmddyy10.
from rptdata.mbr_activation as a
where a.ayb_id in (select distinct ayb_id from refdata.aybid_nps_master_&rundat.)
and a.ayb_id in (select distinct ayb_id from input.ayb_mbr_sbscr_id2_&rundat.)
order by ayb_id
;
quit;
/***
proc print data=work.modality(obs=9);
run;
***/
proc sql;
create table sasdata.five as
select distinct a.*,
b.AYB_MODALITY,
b.AYB_MOD_ENG_DT format=mmddyy10.,
b.TRIGGER_DATE format=mmddyy10.
from sasdata.four as a
left join
work.modality as b
on a.mbr_pgm_id = b.ayb_id
order by a.mbr_id
;
quit;
When you have a left join, all observations from the "left" dataset will be included; if some of those have no match in the "right" dataset, the variables from there will be set to missing.
Well, as for now, they are "just" missing.
Why, only you can find out. Potential problem can be that they are missing in the source, or if you are performing an outer join, missing values will occurs when the row only will be populated from one table.
Or your query logic.
We need more info (like the source data, query/log) to be able to help you better.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.