Hi. I'm trying to figure out the importance/purpose of the Call Missing function being used
in the code below. The code itself reshapes the data so that all unique From_Dt values
appear in a comma delimited list.
Any help would be greatly appreciated.
data have;
input BENE FROM_DT :date9.;
format from_dt date9.;
cards;12345 23OCT2010
12345 11NOV2015
12345 11NOV2015
12345 15DEC2011
12345 11NOV2015;
data want;
array t(999) $9 _temporary_;
call missing(of t(*),n);
do until(last.bene);
set have;
by bene;
temp=put(from_dt,date9.);
if temp not in t then do;
n+1;
t(n)=temp;
end;
end;
want_list=catx(', ',of t(*));
keep bene want_list;
run;
All the variables mentioned in CALL MISSING are retained.
Without CALL MISSING, observations for the second BENE would add to the values found for the previous BENE. CALL MISSING allows each BENE to start with a clean slate and to come up with the dates that belong to that BENE only.
All the variables mentioned in CALL MISSING are retained.
Without CALL MISSING, observations for the second BENE would add to the values found for the previous BENE. CALL MISSING allows each BENE to start with a clean slate and to come up with the dates that belong to that BENE only.
Temporary arrays values are retained across iterations of the datastep i.e when sas processes a new record, values are not reset to missing which is the default. Therefore to override the behavior of temp array, call missing assigns missing values for all array elements. HTH
The data step concatenates all the distinct dates from each BENE group. The call missing erases the dates from the previous BENE group and resets the value of n to missing. Without that call, you could get some dates from the previous BENE group showing up in the current one.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.