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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.