04-15-2016 11:19 AM
Hi Everybody! I am fairly new to SAS and still have trouble with some things.
I have a dataset and want to get the distinct count of members based on two variables. Variable 1 (SDA) has 13 values and Variable 2 (FFYEAR) HAS 7 values. Instead of writing out the code 91 different times (13 X 7 = 91) for all the different combination of variables, is there a way I can write the code once but refer to all the different values in the variable?
I am using SAS 9.2 and here is the basic structure of my current code:
select count (distinct member_id) as count
where sda='A' AND ffyear=2009;
I want to avoid having to write the code over and over for each combination of variable values.
04-15-2016 11:37 AM
I think you need to provide some example data and what you expect the output to look like.
You may be looking for GROUP BY if you really need to do sql;
proc summary data=eligible nway; class SDA FFYEAR Member_id; output out=want (drop=_type_ rename=(_freq_=Count)); run;
Need further help from the community? Please ask a new question.