BookmarkSubscribeRSS Feed
rahulks
Calcite | Level 5

I have a dataset, let say:

     A    B   C

     1     1    1  <-------

     1     1    2

     1     1    3

     1     2    1

     1     2    2  <--------

     1     2    3

     1     3    1

     1     3    2

     1     3    3  <--------

I need only rows having arrow sign assigned to it. Please tell me how can I fetch these rows.

5 REPLIES 5
Tom
Super User Tom
Super User

where b=c ;

rahulks
Calcite | Level 5

thanx tom.

but if dataset would be like this then?

  A    B   C

     1     1    1  <-------

     1     1    2

     1     1    3

     1     2    1

     1     2    2  <--------

     1     2    3

     1     3    1

     1     3    2

     1     3    3  <--------

     2     4    1  <--------

     2     4    2

    2      4    3

    2      4    4

    2      5    1

    2      5    2  <--------

    2      5    3

    2      5    4

basically I got stuck with many to many merge

Tom
Super User Tom
Super User

I do not see any merging as there is only one dataset shown. So what is your criteria? Perhaps you want the first row for the first value of  B within a particular value of A and the second row for the second value of B, etc?

data want ;

  set have ;

  by a b;

  if first.a then bnumber=0;

  if first.b then cnumber=0;

  bnumber+first.b;

  cnumber+1;

  if cnumber=bnumber ;

run;

rahulks
Calcite | Level 5

tom actually I have two datasets

1 . NewTravelplan              

Cardnumber     travel_plan_id

xxxxxx7828         4912

xxxxxx7828         5823

xxxxxx8623         4516

xxxxxx8623         5154

xxxxxx8623         5225

xxxxxx2134         4917

above dataset shows card number and travel_plan_id for the new travel plan customer has opted

2. Available_name.

Cardnumber     travel_plan_name

xxxxxx7828            travel3

xxxxxx7828            travel5

xxxxxx7828            travel6

xxxxxx7828            travel7

xxxxxx7828            travel9

xxxxxx7828            travel7

xxxxxx8623            travel1

xxxxxx8623            travel2

xxxxxx8623            travel9

xxxxxx8623            travel10

xxxxxx2134            travel4

xxxxxx2134            travel5


above dataset shows the available travel_plan_name which on the given card numbers.


Now I have to assign the unique travel_plan_name  to  travel_plan which opted on the card.


I hope you understand, what I mean to say.


I need a travel_plan_name from available_name dataset to put in

Patrick
Opal | Level 21

Taking the first record of "NewTravelplan": What would be the logic to look up "travel_plan_name" in "travel_plan_name"? Which "travel_plan_name" would you add to the data and why?

Cardnumber     travel_plan_id      travel_plan_name

xxxxxx7828         4912                         ????

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!

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.

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
  • 5 replies
  • 878 views
  • 0 likes
  • 3 in conversation