Help using Base SAS procedures

Hi guys, can anyone help me please

Reply
Occasional Contributor
Posts: 14

Hi guys, can anyone help me please

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.

Super User
Super User
Posts: 6,706

Re: Hi guys, can anyone help me please

where b=c ;

Occasional Contributor
Posts: 14

Re: Hi guys, can anyone help me please

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

Super User
Super User
Posts: 6,706

Re: Hi guys, can anyone help me please

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;

Occasional Contributor
Posts: 14

Re: Hi guys, can anyone help me please

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

Respected Advisor
Posts: 4,021

Re: Hi guys, can anyone help me please

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                         ????

Ask a Question
Discussion stats
  • 5 replies
  • 244 views
  • 0 likes
  • 3 in conversation