could one of you please help me on the below ?
Input is on left side and output is on rigth side !!
proc report iam trying but it is not working when it is on blank rows (col4).
Intput | output | ||||||||||||||
Name | Age | col1 | col2 | col3 | col4 | col5 | Name | Age | col1 | col2 | col3 | col4 | col5 | ||
ABC | 25 | bus1 | cat1 | dog1 | pig1 | ABC | 25 | bus1 | cat1 | dog1 | pig1 | ||||
bus1 | cat1 | dog1 | pig2 | pig2 | |||||||||||
bus1 | cat1 | dog1 | pig3 | pig3 | |||||||||||
bus1 | dog1 | pig4 | pig4 | ||||||||||||
bus1 | pig5 | pig5 | |||||||||||||
DEF | 25 | bus1 | cat1 | dog1 | frog1 | pig1 | DEF | 25 | bus1 | cat1 | dog1 | frog1 | pig1 | ||
bus1 | cat1 | dog1 | frog2 | pig2 | frog2 | pig2 | |||||||||
bus1 | cat1 | dog1 | pig3 | pig3 | |||||||||||
bus1 | dog1 | pig4 | pig4 | ||||||||||||
bus1 | pig5 | pig5 |
Data?
That stuff on the left is does not make sense.
And your desired(?) output doesn't make sense either as it clearly shows that Col2 =Cat1and Col3=Dog1 are associated with multiple values of Col5. Cat1 is associated with pig1, pig2 and pig3. Dog1 is associated with pig1, pig2, pig3 and pig4. So the result does not make sense.
What is the LOGIC, as in rules, involved here?
And please provide a starting data set in the form of working data step code.
From what you show I suspect you have already manipulated data and possibly made it harder to accomplish the desired goal.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.