Hi,
I inherited a sas program and am having difficulty understanding what the below SAS dataset is doing. Thank you in advance
libname home '/home/ijones01/projects/Lab/ad_hoc/Quest_Kit';
options compress=yes;
**Sorts the bsca_ma_weekly_report_20221005a data to use for the next step**;
Proc sort data=home.bsca_ma_weekly_report_20221005a out=member_raw nodupkey;by sub_id;
run;
data member_list;
set member_raw end=eof; /*end=eof finds the end of the file*/;
fmtname="$elig_member";
start=Sub_id;
label="*";
type='C';
output ;
if eof then do;
start = '';
hlo = 'O';
label = '';
fmtname = "$elig_member"; output;
end;
run;
FWIW, the data set Member_list is apparently intended to create a FORMAT using the CNTLIN option of Proc format. Without Proc Format that isn't a particularly useful set.
I am going guess that there is some requirement to "mask" the identities of people as that format, named $elig_member will only display * instead of the values that appear in Sub_id.
Additionally, since that format is going to use the HLO option value of O that will also display blank for values of what ever variable besides those provided in Sub_id may appear. Because the HLO option O has to appear as the last "start" value for a format the EOF option, which does not find the end of a file but indicates when the last observation has been read, uses that EOF variable to conditionally set the label and option HLO.
The great thing about SAS in a lot of cases, is that if you run the code, you can figure out what it is doing.
Look at the input data set member_raw, then run the code, then look at the output data set member_list, and you will see what SAS is doing.
FWIW, the data set Member_list is apparently intended to create a FORMAT using the CNTLIN option of Proc format. Without Proc Format that isn't a particularly useful set.
I am going guess that there is some requirement to "mask" the identities of people as that format, named $elig_member will only display * instead of the values that appear in Sub_id.
Additionally, since that format is going to use the HLO option value of O that will also display blank for values of what ever variable besides those provided in Sub_id may appear. Because the HLO option O has to appear as the last "start" value for a format the EOF option, which does not find the end of a file but indicates when the last observation has been read, uses that EOF variable to conditionally set the label and option HLO.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.