SAS Question

Reply
Occasional Contributor
Posts: 13

SAS Question

i have 2 data sets

data test;

input var $;

a1

a

a3

a4;run;

data test1;

input var $

b1

b2

b3

b4

;run;

i need to output as

Output:

a1

b1

a2

b2

a3

b3

a4

b4

2. Need Second transaction of guest using retain statement by ranking the dat

guestid transid amount transdate

Respected Advisor
Posts: 4,173

Re: SAS Question

Posted in reply to NagendraBS

For your first question: If below is a valid solution will depend on how representative your sample data is. It requires that you have the same number of observations in both source data sets (test, test1).

For your second question: I believe there is a lot of information missing for us understand the problem and provide an answer. For formulating a proper question I suggest you describe the actual problem and desired result instead of already asking a question with the solution included "Need Second transaction of guest using retain statement by ranking the dat". Here better tell us what you have (provide representative sample data), describe the problem and then show us how the desired result should look like.

If you have already some - may be not working - code developed then post this as well. Your code helps us to understand on what level of SAS coding skills you are so we can provide a solution which will be helpful to you.

data test;

  input var $;

  datalines;

a1

a2

a3

a4

;

run;

data test1;

  input var $;

  datalines;

b1

b2

b3

b4

;

run;

data want;

  set test;

  output;

  set test1;

  output;

run;

Occasional Contributor
Posts: 13

Re: SAS Question

i have transaction details of guest users

guestid transid amount

101      11021   566     

102      15021   999

101      13260   499

101      15420   645

102       16450  533

102      17894   489

103       14564 154

103     14523   539

SO here i need the guest second transaction details transaction id vary's but not guestid . so using retain statement can we do this or any other methods to finish this task. Please query it

thanks in advance Nagi

Respected Advisor
Posts: 4,173

Re: SAS Question

Posted in reply to NagendraBS

You're throwing a bunch of data at us (I would appreciate if you would post a tested data step creating the sample data set so we don't have to do this) and I don't doubt that you fully understand what you want to achieve. Assume we don't. So how should the expected result look like?

Ask a Question
Discussion stats
  • 3 replies
  • 196 views
  • 0 likes
  • 2 in conversation