Date: Fri, 9 Dec 2005 20:06:58 -0500
Reply-To: Arthur Tabachneck <art297@NETSCAPE.NET>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Arthur Tabachneck <art297@NETSCAPE.NET>
Subject: Re: Tracking fund/function/object codes...
Julie,
Since you are computing all of the sums via if statements, why not just
expand them into if then do ... end combinations;
For example:
if ((fund = 300) and (4000 <= function and function <= 5000) and (200
<= object and object <= 300) ) then do:
A26 + amount;
code='A26';
end;
Art
-----------
<oseithedude@gmail.com> wrote in message
news:1134175571.253731.159420@g49g2000cwa.googlegroups.com...
> Hello! I have some SAS code that codes various fund/function/object
> combinations from a financial report (usually this is a text file
> containing thousands of lines with each line containing the following:
> an account group "id" number, a "fund" number, "function" number,
> "object" number, and corresponding "amount" number) to an alphanumeric
> code. Here is an example of some of the code (please excuse if there
> are errors in the code - I am just typing off of memory):
>
> if ((fund = 300) and (4000 <= function and function <= 5000) and (200
> <= object and object <= 300) ) then A26 + amount;
>
> if ((fund = 640) and (function = 2000) and (100 <= object and object
> <=300)) then B37 + amount;
>
> if ((fund =200) and function in (3000,6000) and (200 <= object and
> object <= 400)) then
> P84 + amount;
>
> The resulting dataset had the id number and all of the possible
> alphanumeric codes as variables and outputs each individual id, along
> with the cumultative value of each alphanumeric code for each id as
> follows:
>
> id A26 B37 P84
> --- ------ ------- ------
> 111 5,426 634 453
> 222 498 24 7,211
> 333 1,487 2,365 2,990
> 444 8.932 9,298 3,734
> 555 3,923 12.35 1,934
>
> That is pretty much what the output dataset looks like (except that
> there are a lot more id numbers and a lot more alphanumeric codes).
> What I wanted to do is, from this program, also create a dataset that
> contains each possible fund/function/object combination and a variable
> called "code" containing the alphanumeric code that the amount that
> particular fund/function/object code had was allocated to. Below is a
> partial sample, of what I'd need the output dataset to look like (there
> would, of course, be thousands of unique fund/function/object
> combinations but below is a listing of four of them).
>
>
> fund function object code
> ------ ----------- --------- --------
> 300 4500 210 A26
> 300 4100 280 A26
> 200 6000 400 P84
> 640 2000 110 B37
>
> Would it be possible to somehow do this? Thanks again for any advice!!!
>
> Julie
>
|