x cd /pub/data/acs/Tools; %let pgm=mcdcprofilesAlt; filename pgm "&pgm..sas"; *---Running after process_mcdcprofilesXyr.sas which does the basic convert to create the input data set. Here we create the "alt" version of the input data set where the _moe variables are moved to the end of the obs. John Blodgett, OSEDA, under contract with the Missouri Census Data Center. We reuse this setup for the various vintages and periods. Started using setup here 9-29-14. ---*; %macro altset(vintage, /* required 4-digit vintage year */ period, /* 1 3 or 5 */ set=usmcdcprofiles, /* base name of input/output sets without period spec. Macro will append 3yr or 5yr per period. */ index=, /* if specified then a datasets step will create an index on this variable in the output (alt) data set. */ debug=0); libname acs&vintage "/pub/data/acs&vintage"; %local setin setout yrsfx setin2; %if &period=1 %then %let yrsfx=; %else %let yrsfx=&period.yr; %let setin=acs&vintage..&set&yrsfx ; %let setout=&setin.alt; %let setin2=&set&yrsfx; data allxmoe; set &setin(drop=%varlist(*_moe,&setin) ); run; data moeonly; set &setin(keep=%varlist(*_moe,&setin) ); run; data &setout(label="Same as &setin2 but with _moe vars last" ); merge allxmoe moeonly; run; %if %superq(index) ne %str() %then %do; proc datasets library=acs&vintage nolist; modify &setin2.alt; index create &index; quit; %end; %mend altset; %altset(2013,3) *<---local utility for OSEDA use only. Others can delete this line---;