How many active Cessna 172 aircraft (or any other make/model) are there in the United States?
The FAA database
In the zip-file you find a number of text files, and a PDF file called 'ardata.pdf'. This file is the key to the other documents.
The 'master.txt' file contains all aircraft records and 'ACFTREF.txt' contains all aircraft types and their id's in the register.
The third column in 'master.txt' is 'MFR MDL CODE', which corresponds to the first column in 'ACFTREF.txt' called 'CODE'.
By finding the right aircraft codes you can find the number of corresponding aircraft in the 'master.txt' file.
My procedure
I imported both text files in Excel and filtered the aircraft file to contain only the Reims and Cessna 172 variants. This resulted in a list of 54 variants.
Then I filtered the master file using the codes I found, resulting in 20,789 aircraft. This number is the total number of Cessna 172s that have a registration assigned to them in the United States.
However, not all aircraft with an assigned registration are actually active. For example, N-numbers can be assigned to reserve a registration while the aircraft is being transferred/imported or may be cancelled while the N-number still is assigned. This is also included in the 'master.txt' file as the 'STATUS' column.
I decided to only look for valid registrations (indicated by the letter 'V'), which returned 18,914 results. So there are 18,914 civil Cessna 172s with a valid registration in the United States. The actual number of Cessna 172s in the US will be lower, since US-registered aircraft may also be operated in other countries. And some of the aircraft with a valid registration may not be active, but I assume that number is low, so a guess of 18,000-19,000 active C172s will be accurate.