Create an Excel file with count on 5 digit zips

Build your list of AccuZIP6 commands by requesting commands and sharing commands with other users

Moderators: Chrissy, Steve, Terry, Donna, Dave, Eric, MartyH, Kristen, Geoff, Vince

Post Reply
User avatar
Site Admin
Posts: 620
Joined: Wed Sep 20, 2006 3:20 pm

Create an Excel file with count on 5 digit zips

Post by Dave » Tue Oct 02, 2007 7:11 am

Copy the following command into the command statement syntax area from the Edit>Command option, then click RUN.

Code: Select all

ON ERROR com_message=message()
alter table alias() add column zip5 c(5)
replace all zip5 with left(zip,5)
SELECT zip5, city, st, count (zip5) as zipcnt ;
	from (com_alias) group by 1,2,3 into table FORCEEXT(DBF(),"")+"-zip5_count"
copy to FORCEEXT(DBF(),"XLS") type XLS
SELECT (com_alias)
delete file FORCEEXT(DBF(),"")+"-zip5_count.dbf"
The command will create a new -ZIP5_COUNT.XLS file in the same location as the original file with the count on 5 digit zips.

Post Reply