• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
      • Introduction to CSPro Language
      • Data Requirements
      • CSPro Program Structure
      • Programming Standards
      • Code Folding
      • Debugging CSPro Applications
      • Declaration Section
        • Compiler Mode
        • Variables
        • Alias Statement
        • User-Defined Functions
        • Array Object
        • Audio Object
        • Case Object
        • Document Object
        • File Object
        • Freq Object
        • Geometry Object
        • HashMap Object
        • Image Object
        • List Object
        • Map Object
        • Pff Object
        • SystemApp Object
        • ValueSet Object
      • Procedural Sections
      • Logic
      • Language Elements
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

Freq Object

In logic, a Freq can be one of two things: an "unnamed" statement used to generate frequencies with a specific set of behaviors regarding how values are tallied, or a CSPro logic object with a name, which allows for the creation of frequencies with control over when the values are tallied. This page is only relevant if using named frequencies.
Functionality
A Freq is a CSPro logic object and the following functions can be called via dot notation:
FunctionDescription
clearResets all tallies to 0.
saveSaves frequency tables to a file.
tallyTallies the frequencies.
viewDisplays frequency tables in an embedded web browser.
 
getLabelReturns the symbol's label.
getNameReturns the symbol's name.
getJsonReturns the symbol's metadata and value represented in JSON.
getValueJsonReturns the symbol's value represented in JSON.
In addition to these object functions, Freq objects can be used as an argument to the view function.
Assignments
Unlike most CSPro logic objects, Freq objects cannot be assigned to other Freq objects.
If the Freq object has only one variable as part of its frequency list, individual tallies of the Freq object can be accessed by using an index:
freq_name(value) = tally;

tally = freq_name(value);
When a Freq object is used as an argument to a user-defined function, it is passed by reference.
Example 1
Freq hh_status_freq(HH_STATUS);

forcase LISTING_DICT where FIPS = 69 do
    hh_status_freq.
tally();
endfor;

hh_status_freq.
view()
               heading(
"Household Status - Northern Mariana Islands");

// show the detailed household status report when some households are incomplete
if hh_status_freq(1) > 0 then
    ShowDetailedHouseholdStatusReport();
endif;
Example 2
PROC GLOBAL

// create a Freq object that will tally the sex and age of
// the first occurrence (the head)
Freq head_sex_age_freq(P03_SEX(1), P04_AGE(1));

PROC CENSUS_DICTIONARY_FF

   
// save the frequency, formatting the ages using a
    // 5-year value set
    head_sex_age_freq.save()
                     
valueset(P04_AGE_5YEAR_VS);

PROC QUEST

   
// only tally households that are not vacant
    if count(PERSON_REC) > 0 then
        head_sex_age_freq.
tally();
   
endif;
See also: Freq Statement (Unnamed)