## identifying maximum investment among ??

Solved
Frequent Contributor
Posts: 97

# identifying maximum investment among ??

hi,

i am providing you sample data ,

where i need to check

1)PAN no should and must be 10 digits .(first 5 places should and must be CHARACETERS)

2)I need to identify the customer who has more than 20% of available corpus

data have1;

infile datalines;

input trdatedate9. invname\$  corpus  trtype\$ PANNO\$

datalines;

14/1/2013 FAISAL        20,000.00       SWITCH         AJYPA*****

14/1/2013 RAMESH    1,000,000.00    PURCHASE   ALOPP*****

11/1/2013 AMIN           250,000.00       PURCHASE  ***PA4084F

11/1/2013 A AMIN       200,000.00       PURCHASE  A*********

15/1/2013 MOHAN       200,000.00      PURCHASE  ACB*******

11/1/2013 RAHUL       100,000.00        PURCHASE  ***PD9407B

10/1/2013 BHAT         15,000.00          PURCHASE  AXQ*******

14/1/2013 SHIRISH        2,500,000.00 PURCHASE   AAGPR9****

14/1/2013 CHATURBHUJ120,000.00   PURCHASE     ***PD0807F

11/1/2013 KUMAR   95,000.00           PURCHASE      ABTPG3****

11/1/2013 G. KUMAR  110,000.00     SWITCH         ADTPM5692E

;

RUN;

Accepted Solutions
Solution
‎01-16-2013 10:35 AM
Regular Contributor
Posts: 171

## Re: identifying maximum investment among ??

Hi Allu,

proc sql;

create table test as

select *,sum(corpus) as total, (corpus/calculated total)*100 as perc

from have1

having calculated perc>20;

quit;

All Replies
Regular Contributor
Posts: 171

## Re: identifying maximum investment among ??

Hi ,

data have1;

informat trdate ddmmyy10.;

format trdate ddmmyy10.;

input trdate invname \$10.  corpus  trtype \$10. PANNO \$10.;

datalines;

14/1/2013 FAISAL     20000   SWITCH    AJYPA*****

14/1/2013 RAMESH     1000000 PURCHASE  ALOPP*****

11/1/2013 AMIN       250000  PURCHASE  ***PA4084F

11/1/2013 A AMIN     200000  PURCHASE  A*********

15/1/2013 MOHAN      200000  PURCHASE  ACB*******

11/1/2013 RAHUL      100000  PURCHASE  ***PD9407B

10/1/2013 BHAT       15000   PURCHASE  AXQ*******

14/1/2013 SHIRISH    2500000 PURCHASE  AAGPR9****

14/1/2013 CHATURBHUJ 120000  PURCHASE  ***PD0807F

11/1/2013 KUMAR      95000   PURCHASE  ABTPG3****

11/1/2013 G. KUMAR   110000  SWITCH    ADTPM5692E

;

RUN;

Data test;

set have1;

flag=ifc(NOTALPHA(substr(PANNO,1,5)),'N','Y');

if flag eq 'Y';

run;

2) Can you elobrate your 2nd question more than 20% of available corpus?

Frequent Contributor
Posts: 97

## Re: identifying maximum investment among ??

hi sam,

the second condition....we need the customer of highest amount to the total corpus ....

i.e

invname   corpus        %of total

faisal       20000

ramesh    1,000,000

AMIN       250,000

.

.

.

like this i need  % of each individual to the total corpus.  ............and who has gone beyond 20%

regards

ALLU

Solution
‎01-16-2013 10:35 AM
Regular Contributor
Posts: 171

## Re: identifying maximum investment among ??

Hi Allu,

proc sql;

create table test as

select *,sum(corpus) as total, (corpus/calculated total)*100 as perc

from have1

having calculated perc>20;

quit;

🔒 This topic is solved and locked.