Art Kendall
unread,Oct 21, 2012, 11:22:34 AM10/21/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
It looks like you might be looking at creating sequential US government
fiscal years.
see if this example syntax does what you want.
new file.
input program.
loop #i = 1 to 1000.
compute mydate = rv.uni(date.dmy(10,1,2008),date.dmy(1,1,2013)).
end case.
end loop.
end file.
end input program.
sort cases by mydate.
formats mydate (adate10).
COMPUTE cal_quarter=XDATE.QUARTER(mydate).
COMPUTE cal_year=XDATE.YEAR(mydate).
FORMATS cal_quarter(f1)cal_year(F4).
numeric fiscal_year (f4).
VARIABLE LABELS
cal_quarter "calendar year quarter"
cal_year "calendar year of the date"
fiscal_year "US Federal fiscal year of the date" .
do if cal_quarter le 3.
compute fiscal_year = cal_year.
else if cal_quarter eq 4.
compute fiscal_year = cal_year + 1.
ELSE.
print / " :( should not be here" $casenum mydate cal_quarter
cal_year fiscal_year
/.
end if.
numeric sequential_fy (f2).
compute sequential_fy = fiscal_year-2007.
list variables= all /cases= by 50.
Art Kendall
Social Research Consultants
On 10/18/2012 3:51 PM, Sarah Samblanet wrote:
>
> I need to convert each of these dates into a value that corresponds to a range of dates:
>
> 1 = October 1, 2008 to September 30, 2008
> 2 = October 1, 2009 to September 30, 2010
> 3 = October 2, 2010 to September 30, 2011
> 4 = October 1, 2011 to September 30, 2012
>
> I am wondering how to do this with syntax in SPSS (and just for my own information, what the corresponding way to do it via dialog boxes/drop-down menus would be).
>