BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
Jesusismygrace
Obsidian | Level 7

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;

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

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.

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

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.

--
Paige Miller
ballardw
Super User

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.

Jesusismygrace
Obsidian | Level 7
Thank you!!!!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 362 views
  • 3 likes
  • 3 in conversation