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.
A Freq is a CSPro logic object and the following functions can be called via
dot notation:
Function | Description |
clear | Resets all tallies to 0. |
save | Saves frequency tables to a file. |
tally | Tallies the frequencies. |
view | Displays frequency tables in an embedded web browser. |
|
getLabel | Returns the symbol's label. |
getName | Returns the symbol's name. |
getJson | Returns the symbol's metadata and value represented in JSON. |
getValueJson | Returns 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.
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);
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;
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;