************************************************************ * AUTHOR * Author: freed302 * Created: <04/04/28 09:29:25 freed302> using writesas.ksh * Time-stamp: <05/02/23 11:47:12 freed302> *----------------------------------------------------------- * DESCRIPTION * This program combines SU and MU files from the BR for a * given year; *----------------------------------------------------------- * REVISION LIST * Date: * By: * Modification: *----------------------------------------------------------- * FILE INFORMATION; %let thisfile=%sysget(PWD)/00.create_br.sas; %put ===========&thisfile; * Everthing above this point is simply basic information about the program. * Obviously there are no set standards for this, but it's considered good * programming standards to at least provide a short description of the purpose * of the program together with author and date information. *----------------------------------------------------------- * INCLUDED PROGRAMS; %include 'config.sas'; * The above program simply contains some common libraries and formats that * this program and a series of programs related to this project use. *----------------------------------------------------------- * MACROS; %let yr=01; * Register year of interest; *----------------------------------------------------------- * OPTIONS; options obs=0; *----------------------------------------------------------- proc contents data=br&yr..ssel20&yr.su;run; proc contents data=br&yr..ssel20&yr.mu;run; * (1) Single-Unit File; data temp.ssel20&yr.su(keep=CFN EIN PPN SIC NAICS STGEO CTYGEO ZIP TRACT EMPLOYMENT PAYROLL EIALPH ALPHA10 PDIV LFO CC); length ALPHA10 $ 10; set br&yr..ssel20&yr.su; if EIALPH^=' ' then ALPHA10=EIALPH||'0000'; if EIALPH=' ' then do; if substr(CFN,1,1)='0' then ALPHA10=CFN; else ALPHA10=substr(CFN,1,6)||'0000'; end; PAYROLL=ACQP1+ACQP2+ACQP3+ACQP4; EMPLOYMENT=ACEMP; if PDIV^='M'; * EXCLUDE SUBMASTERS; if PAYROLL>0 | AC943P>0; * EXCLUDE INACTIVE UNITS; run; * (2) Multi-Unit File; data temp.ssel20&yr.mu(keep=CFN EIN PPN SIC NAICS STGEO CTYGEO ZIP TRACT EMPLOYMENT PAYROLL ALPHA10 PDIV LFO CC); length ALPHA10 $ 10; set br&yr..ssel20&yr.mu; ALPHA10=substr(CFN,1,6)||'0000'; PAYROLL=RAP; EMPLOYMENT=REMP; if ACT^='G'; *EXCLUDE GHOSTS; if PAYROLL>0 | (PAYROLL=0 & (RAPF^='Z' & ACT^='D')); * EXCLUDE INACTIVE UNITS; run; * Combine SU & MU Files; data temp.ssel&yr(keep=ALPHA10 CFN EIN PPN EIALPH ALPHA SIC LFO NAICS STGEO CTYGEO ZIP TRACT PDIV PAYROLL EMPLOYMENT SU MU NAICS YEAR); set temp.ssel20&yr.su(in=a) temp.ssel20&yr.mu(in=b); if a then SU=1;else SU=0; if b then MU=1;else MU=0; year=20&yr; ALPHA=ALPHA10; run; * Eliminating EINs that appear in both the SU (not submaster) and MU files, keeping MU information; proc sort data=temp.ssel&yr out=temp.ssel&yr; by EIN; proc means data=temp.ssel&yr noprint; by EIN; output out=temp.dups(drop=_TYPE_ _FREQ_) n(EMPLOYMENT)=EIN_COUNT; run; data temp.ssel&yr; merge temp.ssel&yr(in=a) temp.dups(in=b); by EIN; * We are concerned about EINs that are in the SU (not submaster) and MU; if EIN_COUNT>1 & SU=1 & PDIV^='M' then delete; run; proc datasets lib=temp; delete ssel&yr.su ssel&yr.mu dups; run; endsas;