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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.