SAS Procedures

Help using Base SAS procedures
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
allurai0412
Fluorite | Level 6

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

14/1/2013 SHASHI   175,000.00         SWITCH         ADC********

;

RUN;

please help...

1 ACCEPTED SOLUTION

Accepted Solutions
sam369
Obsidian | Level 7

Hi Allu,

For your 2nd Question

proc sql;

create table test as

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

from have1

having calculated perc>20;

quit;

View solution in original post

3 REPLIES 3
sam369
Obsidian | Level 7

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

14/1/2013 SHASHI     175000  SWITCH    ADC********

;

RUN;

1) For your 1st Question

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?

allurai0412
Fluorite | Level 6

hi sam,

thanks for your reply..

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

sam369
Obsidian | Level 7

Hi Allu,

For your 2nd Question

proc sql;

create table test as

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

from have1

having calculated perc>20;

quit;

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1149 views
  • 5 likes
  • 2 in conversation