Command Reference : Function Reference : Function Reference: I
  
 
@isperiod
Is observation the first one matching the specified period?
Syntax: @isperiod(d)
d: string
Return: series
Returns a (0, 1) dummy variable for whether the observation is the first that matches the specified date d.
If the natural frequency of the date is greater than or equal to the frequency of the workfile, then only the single observation that includes the date will be assigned a 1. All other observations will be set to 0.
If the natural frequency of the date is lower than the frequency of the workfile, then only the first observation that is included in the date will be assigned the value of 1. All other observations will be set to 0.
Examples
Suppose we create a quarterly workfile running from 2000q1 to 2022q4:
workfile q 2000 2022
Then the commands
series perm12 = @isperiod("2005m12")
series perm4 = @isperiod("2005q4")
will assign a 1 only to the 2000q4 observation since that is the only observation that contains or matches the specified date.
If we use a lower frequency date,
series perm1 = @isperiod("2000")
will assign a 1 only to the 2000q1 observation, since it is the first workfile observation included in the date.
Cross-references
See also @dateval and @makedate