Hello,
Can anyone help me to re-order my value in this dataset. I want my "Q1,Q3" before "min,Max" value in variable _SUBVARLBL_.
data _temp;
set have;
if compress(_subvarlbl_) = 'n' then order_var=1;
else if compress(_subvarlbl_) = 'Mean' then order_var=2;
.....
else order_var = 0;
run;
proc sort data=_temp;
by _varval_ order_var;
run;
Here's the idea, you can code the remaining groups as needed. I used COMPRESS() on the strings because it appears you have leading spaces and this will remove them. Be careful with COMPRESS() and text with hyphens or comma's though.
@unnati wrote:
Hello,
Can anyone help me to re-order my value in this dataset. I want my "Q1,Q3" before "min,Max" value in variable _SUBVARLBL_.
can you provide me answer with code Please ??
Thank you
data _temp;
set have;
if compress(_subvarlbl_) = 'n' then order_var=1;
else if compress(_subvarlbl_) = 'Mean' then order_var=2;
.....
else order_var = 0;
run;
proc sort data=_temp;
by _varval_ order_var;
run;
Here's the idea, you can code the remaining groups as needed. I used COMPRESS() on the strings because it appears you have leading spaces and this will remove them. Be careful with COMPRESS() and text with hyphens or comma's though.
@unnati wrote:
Hello,
Can anyone help me to re-order my value in this dataset. I want my "Q1,Q3" before "min,Max" value in variable _SUBVARLBL_.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.