As we know, If you specify ORDER=DATA, the data are displayed in the same order as they occur in the input data set. Other options for controlling order include ORDER=FORMATTED, which orders according to the formatted values, and ORDER=FREQUENCY, which orders by descending frequency count.
for me, my data is not what i expect, so the tables generate has "No" comes first beore "yes"
when i do copy and paste to the report, it is more time consuming
any advice how to change the order, so the "yes" always comes first before no, for each row, and column for each table?
Thanks.
One trick is to re-format the data. You can put a space before the yes, so it is " yes" and leave the no as "no". If th alignment causes you issues, you can use a non-printable character (you'll need to look at your collating sequence for that).
Consider this code snippet
data report;
set raw;
if raw_value = 'Y' then display_value = 0;
else display_value = 1;
run;
proc format;
value display
0 = 'YES'
1 = 'NO';
run;
proc report data = report missing;
column <your-columns>;
...
define display_value / order = internal format = display.;
...
run;
thank you, but i am using proc freq, and with sas macro
i do not now how to change your code to proc freq, since i have so many tables to generate
One trick is to re-format the data. You can put a space before the yes, so it is " yes" and leave the no as "no". If th alignment causes you issues, you can use a non-printable character (you'll need to look at your collating sequence for that).
Sorry about that. I'm a PROC REPORT guy.
Here is a snippet using PROC FREQ instead.
proc freq data = report; format display_value display.; table display_value / missing list order=internal; run;
thanks
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.