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