BookmarkSubscribeRSS Feed
allurai0412
Fluorite | Level 6

hi ,

i am working with large data base , but i am providing the sample one.

DATA TAXSAVERS;
INPUT AMOUNT LOAD;
DATALINES;
2779 50
16050 50
18000 45
17000 65
2566  20
;
RUN;

I need the  REQUITED DATABASE as follows

1) The first step is "load should be deducted " i.e 2779-50=2729

2) The gross or final TAXSAVER amount should be multiple of 500...i.e 2729 ...would be 2500.

shall i  use the MOD function for the second step.

please help ....is there any PROC in SAS ...if not go ahead with PROC SQL...

3 REPLIES 3
RichardinOz
Quartz | Level 8

DATA TAXSAVERS;
     INPUT AMOUNT LOAD;

     nett = sum(amount, -load) ;

     taxsaver = round(nett - 250, 500) ;
DATALINES;
2779 50
16050 50
18000 45
17000 65
2566  20
;
RUN;

The sum function will calculate the nett amount and return only the original amount if you have null (missing) values for load.

The round function will calculate to the nearest multiple of, in this case, 500; to get the highest value less than or equal to the given amount take 250 off first.

Richard

allurai0412
Fluorite | Level 6

thanks richard good work...

is there any way to do in PROC SQL...?

Patrick
Opal | Level 21

Something like below?

DATA TAXSAVERS;
INPUT AMOUNT LOAD;
DATALINES;
2779 50
16050 50
18000 45
17000 65
2566  20
;
RUN;

proc sql;
  create table want as
  select round(amount-load,500) as taxsaver
  from taxsavers
  ;
quit;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 558 views
  • 5 likes
  • 3 in conversation