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_.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.