|
data test(drop = fy month);
input fy $2. @;
do month = 1 to 12;
input Claim @;
ClaimMo = intnx('month',mdy(month,1,fy),-6);
output;
end;
format claimmo date9.;
cards;
On Mon, 7 Mar 2005 09:57:43 -0800, Choate, Paul@DDS <pchoate@DDS.CA.GOV>
wrote:
>Hi SAS Aficionados - Here is something for a Monday morning.
>
>I have summary claims data in a file organized by fiscal year, I'd like to
>convert the data to monthly claims.
>
>The file has 12 dollar amounts for Jul-Jun named FYMO1-FYMO12 and a two
byte
>alpha Fiscal Year where '04' is the year Jul03-Jun04. My data goes back to
>the 1980s so FY99/00 is a consideration.
>
>I'd like to convert the data from
>FY FYMO1-FYMO12
>03 $101 $102 $103 $104 $105 $106 $107 $108 $109 $110 $111 $112
>
>to
>
> ClaimMo Claim
>'01Jul2002'd $101
>'01Aug2002'd $102
>'01Sep2002'd $103
>'01Oct2002'd $104
>'01Nov2002'd $105
>'01Dec2002'd $106
>'01Jan2003'd $107
>'01Feb2003'd $108
>'01Mar2003'd $109
>'01Apr2003'd $110
>'01May2003'd $111
>'01Jun2003'd $112
>
>
>Here's what first came to mind, but it is pretty ugly for such a simple
>conversion:
>
>
>DATA TEST(KEEP =POSMo POS FY FYMO1-FYMO12);
> retain POSMo POS FY FYMO1-FYMO12;
> Format POSMo yymmdd10.;
> input FY $2. FYMO1-FYMO12;
>
>array FYPOS {12} FYMO1-FYMO12;
>
>do month = 1 to 12;
> IF fy='00' THEN POSMo=input(
> put(input(FY,2.)+not(int(Month/7))*99,z2.)||
> put(mod(month+5,12)+1,z2.)||
> '01',yymmdd6.);
> Else POSMo=input(
> put(input(FY,2.)-not(int(Month/7)),z2.)||
> put(mod(month+5,12)+1,z2.)||
> '01',yymmdd6.);
> POS=FYPOS(month);
> OUTPUT;
>end;
>
>cards;
>99 91 92 93 94 95 96 97 98 99 910 911 912
>00 01 02 03 04 05 06 07 08 09 010 011 012
>01 11 12 13 14 15 16 17 18 19 110 111 112
>;
>run;
>
>
>I see the INTCK and INTNX functions have a federal fiscal year (Oct-Sep)
>format, but don't see a good way to apply it. I don't know of any state
>fiscal year functions or formats. Any ideas appreciated.
>
>
>Paul Choate
>DDS Data Extraction
>(916) 654-2160
|