Saturday, February 6, 2010

How to check how the dataset got sorted without looking at the code?

You can do this manually or programmatically.

Manual Approach: Right click on the data set in the explorer and go to properties, then go to the details tab and see the sorted by values (Works only if you use Windows operating system)
Programmatic approach: Use proc contents and create an output dataset of the contents. The sorted and sortedby columns will give us the details in about how the dataset got sorted in place.

Note: proc contents will give missing values if the dataset isn’t sorted.

*Example;


proc sort data=sashelp.class out=class;
by name sex age;
run;


proc contents data=class out=contents noprint;run;


proc print data=contents;
var memname name sorted sortedby;
run;



('DiggThis’)

0 comments:

Post a Comment

ShareThis