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’)

Comments

Popular posts from this blog

SAS Interview Questions and Answers: CDISC, SDTM and ADAM etc

Comparing Two Methods for Removing Formats and Informats in SAS: DATA Step vs. PROC DATASETS

Studyday calculation ( --DY Variable in SDTM)