AFHood Group Blog The thoughtless yammerings of marketing junkies..

18Sep/091

Using SELECT groups for conditional processing

What are Select Groups?

Select Groups are another way SAS enables conditional processing of datasets.

When should we use Select Groups instead of if-then statements?

According to our friends at SAS, you should utilize Select Groups when your conditional criteria is mutually exclusive and numeric. When this is the case, Select Groups are more efficient than if-then processing.

Here are a few examples of conditional processing using Select Groups:

data NEW_DS;

set DS1;

select var1;

when (1) var2='YES';

when (2) var2='NO';

otherwise var2='UNKNOWN';

end;

run;

data NEW_DS;

set DS1;

select;

when (var1=1 and var2='JAN') var3='YES';

when (var1=2 and var2='FEB') var3='NO';

otherwise var3='UNKNOWN';

end;

run;

Comments (1) Trackbacks (0)
  1. This os really useful function, I used SELECT GROUPS in my last project.
    There is no a huge difference between SELECT GROUPS and IF-THEN statement, but I guess that SELECT GROUPS is used for a smart scripting


Leave a comment

No trackbacks yet.