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.
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.