Given an arbitrary file (not a .sas7bdat file), open the file using FILENAME statement/functions and read the header. Certain patterns in the header are a strong indicator the file may be a SAS data set.
Thanks to Thomas Billings for this tip. Read more details in this paper from WUSS 2017: Methods to Identify and Validate SASProprietary and AES Encrypted SAS Data Sets.