Create an Excel file with count by State

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

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

Post Reply
User avatar
Donna
Site Admin
Posts: 2734
Joined: Mon Mar 18, 2013 9:15 am

Create an Excel file with count by State

Post by Donna » Tue Dec 21, 2021 12:00 pm

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


ON ERROR com_message=message()
SET SAFETY OFF
com_alias=alias()
alter table alias() add column stcnt N(10)
SELECT st, count (st) as stcnt ;
from (com_alias) group by 1 into table FORCEEXT(DBF(),"")+"-st_count"
USE (FORCEEXT(DBF(),"")+"-st_count") IN 0 ALIAS "merge"
SELECT("merge")
copy to FORCEEXT(DBF(),"") type xls
SELECT(com_alias)
USE IN IIF(USED("merge"),SELECT("merge"),0)

Post Reply