BookmarkSubscribeRSS Feed
rafaldow
Fluorite | Level 6

 

I am writing a macro to create customized reports by combining output from Proc GLM ODS tables (ParameterEstimates and ModelANOVA). The report needs to accommodate not only varying numbers of main effects, but also interactions of varying orders.  Processing is conditional based on effect labels for each model term, which are extracted from the ODS datasets.  

 

I realize that the Proc GLM option NAMELEN= can be used to specify the length of effect names in tables and output datasets (default=20); however, in no SAS manuals, online FAQs, or other documentation have I found a description of the algorithm used by SAS to abbreviate variable names into effect labels of the specified length.  For main effect terms, the effect labels appear to be a simple truncation of the variable name if it exceeds the specified length.   For interactions, though, effect labels do not appear to be simple, equal truncations of the constituent variable names; but it is not obvious what algorithm is being using to abbreviate the constituent variable names, joined by '*'s, into effect labels.     

 

This seems like such a simple problem that I must be overlooking something obvious.  Any thoughts or insights would be greatly appreciated!  

 

~ Richard 

6 REPLIES 6
PaigeMiller
Diamond | Level 26

I don't know the answer to your question. But if you  set NAMELEN=200, and even in the case where you have variables with 32 character names, you can accomodate 5-way interactions before the truncation happens, that ought to suffice for most situations.

--
Paige Miller
rafaldow
Fluorite | Level 6
Yes... Thank you, Paige. I realized that and setting the length to the maximum value is the interim solution I am using. It is not viable as a general solution, though, because the report layouts do not support very long effect names without incomprehensible wrapping occurring. For formatting purposes, the abbreviated effect names have substantial advantages, although I do have flexibility to adjust lengths up to about 40 or 50 characters.
PaigeMiller
Diamond | Level 26

So the problem is in the report layouts and not GLM?

 

You could run GLM with NAMELEN=200 so you can unambiguously determine what GLM is doing, and then do the truncation yourself before the report, it's all under your control.

--
Paige Miller
rafaldow
Fluorite | Level 6
Thanks so much for your help!

The report layout is a limiting factor, but SAS's abbreviation algorithm that generates effect labels usually produces comprehensible abbreviations, so I am trying to take advantage of it.

The macro initially generates a set of verbose effect labels based on full variable names expressed in the GLM model statement, along with positioning codes that describe where in the report they should be placed. It tries to then emulate SAS's abbreviated effect labels to match with the abbreviated effect labels in the SAS ODS output datasets in order to extract the associated values (parameter estimates, SEs, test statistics, pvals). The abbreviated effect labels and an extensively reformatted set of statistical values are then added to the body of the report in appropriate places (designated by the positioning codes). A comprehensive list of verbose effect descriptions and abbreviated effect names are added at the end of the report, but the abbreviated effect names are still needed in the body of the report.

Also, it may not have been clear, but dependent and predictor variables for the Proc GLM Class and Model statements cannot be predicted in advance. They are input as part of the macro call.
Reeza
Super User

You need to provide more information to get help for us to understand why this is an issue. Sample code illustrating the issue would likely help here.

PaigeMiller
Diamond | Level 26

@rafaldow wrote:


The macro initially generates a set of verbose effect labels based on full variable names expressed in the GLM model statement, along with positioning codes that describe where in the report they should be placed. It tries to then emulate SAS's abbreviated effect labels to match with the abbreviated effect labels in the SAS ODS output datasets in order to extract the associated values (parameter estimates, SEs, test statistics, pvals). The abbreviated effect labels and an extensively reformatted set of statistical values are then added to the body of the report in appropriate places (designated by the positioning codes). A comprehensive list of verbose effect descriptions and abbreviated effect names are added at the end of the report, but the abbreviated effect names are still needed in the body of the report.

So, given the above, I still really have no idea what the problem is that you want to solve. It seems to keep changing. I agree with @Reeza , you need to show us sample code, plus you need to show us the output from GLM you are working with, and you need to show us what you want as a final table.

--
Paige Miller

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1340 views
  • 0 likes
  • 3 in conversation