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..
SLNO | MOHDESC | JOINT1 NAME | PANGNO | PANGNO2 |
1 | JOINT MODE | MRUNALINI | AACPD***** | *****9755K |
2 | JOINT MODE | ALLU | AHEPS***** | *****7493Q |
3 | ANYONE OR SURVIVOR | HANSA | AKJPS***** | *****9102J |
4 | ANYONE OR SURVIVOR | SHAH | AKJPS***** | *****9103K |
5 | ANYONE OR SURVIVOR | CHANDRA | AACPS***** | *****8379A |
6 | ANYONE OR SURVIVOR | VISHWANATH | AHPPP***** | *****8187B |
7 | ANYONE OR SURVIVOR | SARIT | AACPT***** | *****6408C |
8 | SINGLE | JOYCE | ABQPT***** | |
9 | SINGLE | LALKUMAR CHHEDA | AAAPC***** | |
10 | SINGLE | RAJNI | AABPT***** | *****9260F |
11 | SINGLE | PAREKH | ACDPP***** | *****0067L |
12 | ANYONE OR SURVIVOR | RACHANA | ACZPG***** | *****4471F |
13 | ANYONE OR SURVIVOR | MUKTA | AAAPP***** | *****9000A |
14 | ANYONE OR SURVIVOR | SUMIT | ABIPB***** | *****0438P |
My output requires like this..
SLNO | MOHDESC | JOINT1 NAME | PANGNO | PANGNO2 | Authorisation of trans |
1 | JOINT MODE | MRUNALINI | AACPD***** | *****9755K | Both |
2 | JOINT MODE | ALLU | AHEPS***** | *****7493Q | Both |
3 | ANYONE OR SURVIVOR | HANSA | AKJPS***** | *****9102J | Any |
4 | ANYONE OR SURVIVOR | SHAH | AKJPS***** | *****9103K | Any |
5 | ANYONE OR SURVIVOR | CHANDRA | AACPS***** | *****8379A | Any |
6 | ANYONE OR SURVIVOR | VISHWANATH | AHPPP***** | *****8187B | Any |
7 | ANYONE OR SURVIVOR | SARIT | AACPT***** | *****6408C | Any |
8 | SINGLE | JOYCE | ABQPT***** | 0 | single |
9 | SINGLE | LALKUMAR CHHEDA | AAAPC***** | 0 | single |
10 | SINGLE | RAJNI | AABPT***** | *****9260F | invalid |
11 | SINGLE | PAREKH | ACDPP***** | *****0067L | invalid |
12 | ANYONE OR SURVIVOR | RACHANA | ACZPG***** | *****4471F | Any |
13 | ANYONE OR SURVIVOR | MUKTA | AAAPP***** | 0 | invalid |
14 | ANYONE OR SURVIVOR | SUMIT | ABIPB***** | 0 | invalid |
Regards
ALLU
Is the question how to make the last column in the output? Not clear on the help that is needed.
EJ
yes...the question about the last coulmn....
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;
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
Thanks....
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";
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.
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.