UWA Logo
  Planning Services | Statistics Office | IRU | EIS    
           
University Statistics
Internal
Contacts

SAS Formats

Formats. What are they good for?

Although working with codes all day is fun, sometimes formats are needed to make our cryptic data intelligible to humans. The two purposes of our formats are:

1. Applying a label or name to a code (eg. to display the course name associated with a course code)

2. Mapping from one variable to another (eg. to determine which faculty a school belongs to)

It makes sense that we use a common set of formats, and on this page, these shared formats are documented. To use them yourself, make sure your "autoexec.sas" file (which is run whenever SAS starts up) contains the following line -

libname library 'p:\stats\sasprod\formats';

To apply a format within a data step, write a put statement like this -

course_name = put(course, $ps_course.);

Naming Convention

Formats should be given names that explain exactly what they do. These shared formats are named using the following principles -

  • They are all prefixed by a "ps_" indicating Planning Services. This is an interim measure, and when the transition to new formats finishes, this can be removed.
  • If the format maps from one variable to another, then separate the two variables by a "2" eg. - ps_school2faculty
  • If the format applies a label or name to a code, then merely call it by the name of the variable, eg ps_school
  • Abbreviations are not used, so for example faculty is used rather than fac.
  • An underscore is used to separate words in a format name, eg. ps_entrance_category
  • The format name is the same as the SAS program used to generate it. It makes it simple to find.
  • Mapping to a code, the format is just the name of the variable eg. school2faculty_code.sas maps from school to faculty code whereas school2faculty.sas maps to the faculty name.
  • Maximum format name length is 31 for character formats and 32 for numeric.

Description of Formats

Hover over name for further description, click name to see content of format
(Revised 30 Oct 2009 )

 
PS_ADMISSION_BASIS PS_AGE PS_AGE_STAFF
PS_BROAD_FIELD_OF_EDUCATION
PS_CAMPUS PS_CITIZENSHIP PS_CLASSIFICATION PS_CLUSTER PS_COUNTRY PS_COUNTRY2REGION PS_COURSE PS_COURSE2COURSE_TYPE_CODE PS_COURSE2FACULTY PS_COURSE2FOE PS_COURSE2SCHOOL_CODE PS_COURSE2UNITSET_CODE PS_COURSE2UWACOURSE_TYPE PS_COURSE_RESULT PS_COURSE_SHORT PS_COURSE_TYPE PS_COURSE_TYPE2BRD_COURSE_TYPE PS_COURSE_TYPE_FULL
PS_DEPARTMENT2DIVISION PS_DEPARTMENT2DIVISION_CODE PS_DEPARTMENT_LONG PS_DEPARTMENT_PARENT PS_DEPARTMENT_SHORT
PS_ENTRANCE_CATEGORY
PS_FACULTY PS_FIELD_OF_EDUCATION PS_FIELD_OF_EDUCATION2COST PS_FOE2CLUSTER_CODE PS_FOE2GCA_FIELD PS_FUNCTION
PS_GCA_FIELD_OF_EDUCATION
PS_HIGHEST_ATTAINMENT
PS_INDIGENOUS PS_INSTITUTION PS_INSTITUTION_TYPE
PS_LANGUAGE
PS_POSTCODE PS_POSTCODE2REGION
PS_SCHOOL2FACULTY PS_SCHOOL_SHORT PS_SCHOOL_TYPE PS_SECONDARY_SCHOOL PS_STUDENT_STATUS
PS_UNIT PS_UNITSET PS_UNITSET2FOE PS_UNITSET2MAJOR PS_UNITSET2SCHOOL_CODE

Creating New Formats

If you need a format that isn't listed here, then use the SAS code in p:\stats\sasprod\formats\revolution\ as a template for creating the new format. Your header must be contain the following elements:

/* *************************************************************************
 *    FILE: ps_broad_field_of_education.sas
 *    INFO: Broad fields of education - DEEWR codes<br />e.g. '02' -> 'Information Technology'
 * UPDATER: Bart Simpson
 *    WHEN: 16-Jul-2009
 *  SOURCE: Callista (direct)
 * ************************************************************************* */

The INFO: line is used as the content for the tooltip describing the format. Use the <br /> tag as a tooltip linebreak, and include an example of the format, if possible.

When you have created your format follow the procedure below to document it and make it available to everyone.

  1. Run it in SAS to add it to the shared library (named 'library')
  2. Run \revolution\code\ExportFormats.sas to create a listing of relevant formats in \revolution\code\SAS_output.html.
  3. Run (or get another programmer to run) the Perl script \revolution\code\ParseFormats.pl. This creates the HTML describing the formats, and saves it in w:/internal/sas_formats/.
  4. Copy the contents of \revolution\code\formatSummary.html between the lines indicated by
    <!-- Copy from following line into MySource -->
    .
    .
    .
    <!-- Copy to previous line into MySource -->
    into www.stats.uwa.edu.au/Internal/sas_formats/formatsummary.
Note that strawberry perl can be installed easily - download and unzip the package then type "cpan" and then type "install".
Top of Page