BookmarkSubscribeRSS Feed
NagendraBS
Fluorite | Level 6

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

3 REPLIES 3
Patrick
Opal | Level 21

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;

NagendraBS
Fluorite | Level 6

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

Patrick
Opal | Level 21

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?

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!

How to Concatenate Values

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.

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