Hello,
I am trying to transpose data after the proc compare.
Here is what the data currently looks like after the proc compare:
| fullname | _type_ | cube | mdx_condition |
| Testuser1 | BASE | UG_Applicants | XYZ |
| Testuser1 | BASE | UG_Degrees | XYZ |
| Testuser1 | BASE | UG_Enrollment | XYZ |
| Testuser1 | BASE | GR_Applicants | XYZ |
| Testuser1 | BASE | GR_Degrees | XYZ |
| Testuser1 | BASE | GR_Enrollment | XYZ |
| Testuser2 | COMPARE | Waitlist_Student_Data | abc |
| Testuser2 | COMPARE | UG_Applicants | abc |
| Testuser2 | COMPARE | UG_Degrees | abc |
| Testuser2 | COMPARE | UG_Enrollment | abc |
Here is what I need the data to look like:
fullname Variable Name BASE COMPARE
| Testuser1 | UG_Applicants | xyz | |
| Testuser1 | UG_Degrees | xyz | |
| Testuser1 | UG_Enrollment | xyz | |
| Testuser1 | GR_Applicants | xyz | |
| Testuser1 | GR_Degrees | xyz | |
| Testuser1 | GR_Enrollment | xyz | |
| Testuser2 | Waitlist_Student_Data | abc | |
| Testuser2 | UG_Applicants | abc | |
| Testuser2 | UG_Degrees | abc | |
| Testuser2 | UG_Enrollment | abc |
Any help would be great, thanks!
Can you show what you tried?
Is the exact order important? If so transpose may not be the best way.
Perhaps:
data want; set have; If _type_='BASE' then BASE=mdx_condition; else if _type_='COMPARE' then Compare=mdx_condition; drop _type_ mdx_condition; run;
if you want to change the variable name from cube to variable_name either use rename or add a label for cube.
Can you show what you tried?
Is the exact order important? If so transpose may not be the best way.
Perhaps:
data want; set have; If _type_='BASE' then BASE=mdx_condition; else if _type_='COMPARE' then Compare=mdx_condition; drop _type_ mdx_condition; run;
if you want to change the variable name from cube to variable_name either use rename or add a label for cube.
CFC_SAS_Communities_400x225.jpg
It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.
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.
Ready to level-up your skills? Choose your own adventure.