DATA Step, Macro, Functions and more

Transactions depending upon Mode of holding !!

Reply
Frequent Contributor
Posts: 97

Transactions depending upon Mode of holding !!

hi ,

My data looks like this ..

For JOINT MODE and ANYONE OR SURVIVOR ...>PANGNO , PANGNO2 ...should and must be there.

For Single ..............> only one filed PANGNO ......should be there..

SLNOMOHDESCJOINT1 NAMEPANGNOPANGNO2
1JOINT MODEMRUNALINIAACPD**********9755K
2JOINT MODEALLUAHEPS**********7493Q
3ANYONE OR SURVIVORHANSAAKJPS**********9102J
4ANYONE OR SURVIVORSHAHAKJPS**********9103K
5ANYONE OR SURVIVORCHANDRAAACPS**********8379A
6ANYONE OR SURVIVORVISHWANATHAHPPP**********8187B
7ANYONE OR SURVIVORSARITAACPT**********6408C
8SINGLEJOYCEABQPT*****
9SINGLELALKUMAR CHHEDAAAAPC*****
10SINGLERAJNIAABPT**********9260F
11SINGLEPAREKHACDPP**********0067L
12ANYONE OR SURVIVORRACHANAACZPG**********4471F
13ANYONE OR SURVIVORMUKTAAAAPP**********9000A
14ANYONE OR SURVIVORSUMITABIPB**********0438P

My output requires like this..

SLNOMOHDESCJOINT1 NAMEPANGNOPANGNO2Authorisation of trans
1JOINT MODEMRUNALINIAACPD**********9755KBoth
2JOINT MODEALLUAHEPS**********7493QBoth
3ANYONE OR SURVIVORHANSAAKJPS**********9102JAny
4ANYONE OR SURVIVORSHAHAKJPS**********9103KAny
5ANYONE OR SURVIVORCHANDRAAACPS**********8379AAny
6ANYONE OR SURVIVORVISHWANATHAHPPP**********8187BAny
7ANYONE OR SURVIVORSARITAACPT**********6408CAny
8SINGLEJOYCEABQPT*****0single
9SINGLELALKUMAR CHHEDAAAAPC*****0single
10SINGLERAJNIAABPT**********9260Finvalid
11SINGLEPAREKHACDPP**********0067Linvalid
12ANYONE OR SURVIVORRACHANAACZPG**********4471FAny
13ANYONE OR SURVIVORMUKTAAAAPP*****0invalid
14ANYONE OR SURVIVORSUMITABIPB*****0invalid

Regards

ALLU

Super Contributor
Posts: 334

Re: Transactions depending upon Mode of holding !!

Posted in reply to allurai0412

Is the question how to make the last column in the output? Not clear on the help that is needed.

EJ

Frequent Contributor
Posts: 97

Re: Transactions depending upon Mode of holding !!

yes...the question about the last coulmn....


Super Contributor
Posts: 334

Re: Transactions depending upon Mode of holding !!

Posted in reply to allurai0412

See if this works.  Check the capitalization of the data to make sure the code matches the data.

data output;

     length auth $ 15;

     set data;

     auth = "Invalid";

     if MOHDESC in ("JOINT MODE" "ANYONE OR SURVIVOR") and PANGNO ne "" and PANGNO2 ne "" then do;

          if mohdesc = "JOINT MODE" then auth = "Both";

               else auth = "Any";

     end;

          else if MOHDESC = "SINGLE" and (PANGNO ne "" or PANGNO2 ne "") then auth ="single";

run;

Frequent Contributor
Posts: 97

Re: Transactions depending upon Mode of holding !!

hi...

i need the condition for  "SINGLE "

like this

it should and must have only one "PANGNO ".... will below code , that you have provided works ??

"

  else if MOHDESC = "SINGLE" and (PANGNO ne "" or PANGNO2 ne "") then auth ="single";

"

regards

ALLU

Frequent Contributor
Posts: 97

Re: Transactions depending upon Mode of holding !!

Thanks....

Super Contributor
Posts: 334

Re: Transactions depending upon Mode of holding !!

Posted in reply to allurai0412

if it you want to check for only one PAGNO for Single I would do something like the following:

  else if MOHDESC = "SINGLE" and ((PANGNO ne "" and  PANGNO2 = "")  or ((PANGNO = "" and  PANGNO2 ne ""))

then auth ="single";

Ask a Question
Discussion stats
  • 6 replies
  • 237 views
  • 3 likes
  • 2 in conversation