According to the documentation, the first parameter to CALL DEFINE (column-id) is (among others)
Why is the column name not accepted in this example code:
proc format;
value myfmt 100-high="high";
run;
proc report data=sashelp.class;
column name age;
define name / display;
define age / sum;
rbreak after / summarize;
compute after;
name = "total";
call define ("age","format","myfmt.");
endcomp;
run;
It works with either the numerical column number (2) or the sequential column name ("_c2_").
And it works if an alias is used:
proc report data=sashelp.class;
column name age=xxx;
define name / display;
define xxx / sum;
/*compute age;
if _break_ = "_RBREAK_" then call define (_col_,"format","3.");
endcomp;*/
rbreak after / summarize;
compute after;
name = "total";
call define ("xxx","format","myfmt.");
endcomp;
run;
So what is the difference between the column name itself and the alias?
The name is AGE.SUM for an analysis variable.
call define ("age.sum","format","myfmt.");
Makes sense. But why does the alias work without .sum? Is the alias in fact applied to the statistic, and not the variable as such?
That somehow led me to the relevant piece of documentation that describes it..
Thank you to all!
@JackHamilton wrote:
Is there a way to find the absolute column numbers of columns without preprocessing the data?
Just to make up a simple example of when that might be useful, let's suppose I have some id columns, and then across columns for a variable, then a summary column, and I want to make the last across column pink. If I knew the column number of the final summary column, I could find the column number of the last across column by subtracting 1.
I have occasionally had reason to run a PROC SUMMARY on data, and then PROC REPORT on the summary output. It surprised me that sometimes with large data sets the SUMMARY+REPORT approach was noticeably faster than creating the same final report using PROC REPORT alone. I would have thought the run times would be very similar because the same calculation engine is used in both.
Better to put this in its own thread, rather than here in an unrelated (and solved) thread.
Your question is unrelated, but more important, my question has been solved and marked as such, so any additional post won't get much attention.
Therefore it's better for you to post your question in a new topic.
@JackHamilton I'm not going to debate it with you. You should see this at the top of the thread:
So help yourself, and help the Community — start a new thread.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.