BookmarkSubscribeRSS Feed
fred777
Calcite | Level 5

So I ran this little piece of code under SAS9.4 M0 and also under M3 and get a different name for the colpctsum variable!

 

proc tabulate data=sashelp.cars out=fred;

   var horsepower;

   class origin;

   table origin,horsepower*colpctsum;

run;

 

Under M0 the var name is: Horsepower_PctSum_0

Under M3 the var name is: Horsepower_PctSum_0_Horsepower

 

This is very unfortunate and is causing us a lot of grief!

 

Is there anything in the release notes that refers to this new behaviour?

 

Thanks

 

3 REPLIES 3
Reeza
Super User

I would definitely contact tech support with this question, if you haven't already. 

bstrac
Calcite | Level 5

We just upgraded from 9.4M2 to 9.4M4 and experienced the same column naming issue when using PROC TABULATE between versions.

 

I know it has been a long time since this post was created but did you find anything out from tech support?

ChrisHemedinger
Community Manager

Here's a SAS note that describes the change.  It was intentional -- to help with name collisions.  But unfortunately it broke your process.

 

More documentation/explanation in this Usage Note 45710: Naming convention for statistics in an output data set created by PROC TAB....

 

Here is a brute-force SAS macro program -- which I dug out of a Tech Support track and which you should definitely test before using in production -- that renames the variables back to the old style, trimming the underscore-number suffix.

 

%macro myrename(dsn=&syslast);
  %let lib=%scan(&syslast,1,%str(.));
  %let mem=%scan(&syslast,2,%str(.));
  proc sql  noprint;
  /* generate a command line : RENAME oldname=newname */
   select catt('rename',' '!!name,'=',substr(name,1,length(name)-index(reverse(trim(name)),'_'))) into:renamelist separated by ";"
   from sashelp.vcolumn where libname=upcase("&lib.") and memname=upcase("&mem.") and (lowcase(name) like '%_pctsum_%' OR lowcase(name) like '%_pctn_%' );
  /* execute this command in proc datasets */
  proc datasets lib=&lib nolist;    modify &mem;    &renamelist;  run;quit;
%mend myrename;
%myrename;
It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

sas-innovate-2024.png

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.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 3 replies
  • 1343 views
  • 4 likes
  • 4 in conversation