BookmarkSubscribeRSS Feed
kyath_sas
Calcite | Level 5

Hi Friends,

please resolve my issue

 

data have;
input sno seqnum codenum dnum  b$;
datalines;
1 1  100 2 a
1 2  100 3 b
1 5  100 3 c
1 6  100 3 d
1 4  200 2 e
1 5  200 2 f
1 6  200 3 g
1 7  200 3 h
2 3  150 2 i
2 5  150 3 j
2 6  150 4 k
2 1  250 2 l
2 2  250 3 m
2 1  300 2 n
3 11 200 2 o
3 12 200 3 p
3 13 200 3 q
3 15 200 4 r
3 10 250 2 s

;
run;

output like this:

1 100 3 a,b
1 100 3 a,c
1 100 3 a,d
1 200 2 e
1 200 3 f,g
1 200 3 f,h
2 150 4 i,j,k
2 250 3 l,m
2 300 2 n
3 200 4 o,p,r
3 200 4 o,q,r
3 250 2 s


here i gave already sorted data based on first 4 variables i need vertical concatenation

4th variable sequence is based on 2nd variable

please see input data i have added all patterns ..i have huge records like this 

and in original data 4th variable values are from 2 to20max.

 

based on 1st 3rd variable  grouping

dnum variable seq :

1) 2-3-4-5 seq give 1 line

2) 2-3-3 seq give 2lines   2,3 and 2,3

3) 2-3-4-4-5 seq gives 2lines  2,3,first4,5 and 2,3,second4,5

4) only 2  gives only 1 line 

 

2 REPLIES 2
PGStats
Opal | Level 21

Why isn't

 

1 200 3 e,g

1 200 3 e,h

 

part of the output table?

PG
kyath_sas
Calcite | Level 5

 

 in 1 4  200 2 e  line have only primary line

 

 

            2    primary

    3           3 secondary

            4       4 tertiary

                 5      5

 

 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1076 views
  • 0 likes
  • 2 in conversation