Home > Data Services > Catalog . Restricted Data . Census . ACS

Search Data Services

Meta Search
search across all the following databases:

Data Catalog
Data and documentation

KnowledgeBase
Common questions and answers.

Resources
Entire collection of data resources.


Latest Data News

RSS Feed icon

Lessons from North of the Border

Nerd Alert: Dictionary of Numbers

International Migration Statistics for the US

Open Data Executive Order

Measuring Marriage & Divorce among Same-Sex Couples

Formats file outside program file

Typically, if a user wants to add formats to a file they are added as the data are read in. However, if a user anticipates using lots of formats in a data set and wants to be able to easily modify the formats file, it is easier to have a separate formats file.

The following is an example of what this file, formats.sas, would look like.

libname nepal '/usr/dawork/neidert/nepal';
options ls=80 ps = 60;
proc format fmtlib library=nepal cntlout=dsfmt;
value ffchck 1 = 'yes'
             . = 'not checked'
             .a = 'inap/skip'  ;
value ffeduc 11 = 'S.L.C or equiv'
             12 = 'I.A. or equiv'
             14 = 'B.A. or equiv'
             16 = 'M.A. or equiv'
             18 = 'Ph.D. or equiv'
             .a = 'inap/skip'
             .d = 'don''t know'
             . = 'no response given'
;
value ffagree 1 = 'agree'
             2 = 'somewhat agree'
             3 = 'disagree'
            .a = 'inap'
            .d = 'don''t know'
            .  = 'no response given'
;
run;
quit;

Typically, this file would be much larger. If the user wants to add another format to the file, say 'yesno,' the file would now look like this:

libname nepal '/usr/dawork/neidert/nepal';
options ls=80 ps = 60;
proc format fmtlib library=nepal cntlout=dsfmt;
value ffchck  1 = 'yes'
              . = 'not checked'
             .a = 'inap/skip'
;
value ffeduc 11 = 'S.L.C or equiv'
             12 = 'I.A. or equiv'
             14 = 'B.A. or equiv'
             16 = 'M.A. or equiv'
             18 = 'Ph.D. or equiv'
             .a = 'inap/skip'
             .d = 'don''t know'
             . = 'no response given'
;
value ffagree 1 = 'agree'
              2 = 'somewhat agree'
              3 = 'disagree'
             .a = 'inap'
             .d = 'don''t know'
             .  = 'no response given'
;
value yesno   1 = 'yes'
              0 = 'no'
             .a = 'inap'
             .d = 'don''t know'
             .  = 'no response given'
;
run;
quit;

To activate this new format:

sas formats.sas

This replaces the previous formats.sct01 file with a new format.sct01 file.