As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.
Here are some tips for How to share your SAS knowledge with your professional network.
Tips:Using UPDATE to Collapse a Data Set
data have ; input ID VAR_1 VAR_2 VAR_3 ; cards; 001 1 . 3 001 . 2 . 001 . . 4 002 . 2 . 002 1 . . 002 . 2 3 run; data want ; update have (obs=0 keep=id) have; by id; run;
The UPDATE statement can be used to collapse a data set within an ID variable. Missing values can be replaced and the latest non-missing value is retained.
The KEEP= data set option on the first instance of HAVE will force the BY variable(s) to be the first variables on the data set WANT. If the KEEP= option had not been used, the original variable order would be maintained.