sas

How do I remove all SAS formats from a sas7bdat table?


I have a sas7bdat table that contains format information but I do not have the formats, so lots of the data appears as * and doesn't make much sense. I know the informat data that lies beneath is there — how can I remove all formats from the table?


Solution

  • There is another way in addition to @JustinDavies's answer that is to use PROC DATASETS procedure.

    Adapted from the SAS documentation: Example 1: Removing All Labels and Formats in a Data Set

    proc datasets lib=<your library> memtype=data nolist;
       modify <your dataset>; 
         attrib _all_ label=' '; 
         attrib _all_ format=;
         attrib _all_ informat=;
    run;
    

    The advantage in using PROC DATASETS is that it modifies the dataset's metadata in-place - i.e., it is not going to create a new dataset as suggested in the other answer to this question. That feature could be of advantage if your dataset is large.