UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Using Allocation Flags in the 1990 U.S. Persons Data

Because of the large size of the 1990 US PUMS Persons data file, it was necessary to store the allocation flags in a packed binary form. Rather than consuming 3 bytes of storage space for each allocation flag, the packed binary flags consume only 1 bit of storage space. However, if you with to use the allocation flags in this data file, it is necessary to unpack these flags in a DATA step. ATS has provided a sample program which illustrates how to unpack all of the allocation flags called us90miss.sas.

Example 1, shown below, is based on the us90miss.sas program. This example unpacks the allocation flags for age (aage) and income1 (aincome1), and keeps the regular variables age, income1, and sex. The us90miss.sas program was modified in two ways to create Example 1. First, the variables age, income1, and sex were added to the keep statement (line 5). Second, the statements unpacking the other allocation flags were deleted. You can copy the us90miss.sas program and modify it to suit your needs.

Example 1. Unpacking aage and aincome1 from the US 90 PUMS Persons Data file

* create a temporary datafile called mymiss; 
Data mymiss; 

  * read in us90pump data, be sure to keep amiss1 and amiss2 ; 
  * put any other variables you want in keep statement below; 
  set "c:\censusdata\us90pump"(keep = amiss1 amiss2 age income1 sex);
   
  * include next 2 lines if you are obtaining aincome1-aincome8;
  Length amissCH2 $ 41; 
  amissCh2 = put(amiss2, $binary16.);
  
  * include next 2 lines if you are obtaining any allocation flags; 
  * except for aincome1-aincome8; Length amissCH1 $ 41; 
  amissCh1 = put(amiss1, $binary41.);
  
  Length AAGE    3; 
  AAGE      = input(substr(amissCH1, 5, 1), 1.); 
  
  Length AINCOME1   3; 
  AINCOME1     = input(substr(amissCH2, 1, 2), binary2.); 
  
  * The drop statement is used to discard the variables used; 
  * to create the allocation flags, and which are no longer needed; 
  Drop amiss1 amiss2 amissCH1 amissCH2; 
Run;

PROC FREQ DATA=mymiss; 
  TABLES aage aincome1 age income1 sex; 
RUN; 

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California