BookmarkSubscribeRSS Feed
LtRogers
Fluorite | Level 6

My proc tabulate

proc tabulate data=s_18  format=nlnum32. out=s_18_CF;
class original_currency yearno company_name company_bk company_type_code period_name typeno;
var   epifp;
by    Company_Name company_bk company_type_code period_name ;
 
table yearno='Year'*company_name='Company'*company_bk='nr'*company_type_code='Institutgroup'*original_currency='Curr'*period_name='Period'
all='Total', all='Total'*(epifp);
run;

I get this notes in the log and I can't understand why. Has anyone an idea of why? Why does SAS create new names?
NOTE: Variable Company_Name already exists on file WORK.S_18_CF, using Company_Name2 instead.
NOTE: Variable Company_BK already exists on file WORK.S_18_CF, using Company_BK2 instead.
NOTE: Variable Company_Type_Code already exists on file WORK.S_18_CF, using Company_Type_Code2 instead.
NOTE: Variable Period_Name already exists on file WORK.S_18_CF, using Period_Name2 instead.
NOTE: The above message was for the following BY group:
      Company name=XXX Company_BK=NNNN Company type code=SSS Period name=2022
3 REPLIES 3
ChrisNZ
Tourmaline | Level 20

You're asking proc tabulate to use variables in the table crossings AND in the BY groups.

The variables are used twice in your logic, so they appear twice in the output data set and need different names.

Patrick
Opal | Level 21

From the looks of it and to avoid the root cause for warnings as explained by @ChrisNZ I believe one of below coding options should return what you're after.

proc tabulate data=s_18  format=nlnum32. out=s_18_CF;
  class original_currency yearno company_name company_bk company_type_code period_name typeno;
  var   epifp;
  table 
    Company_Name
      *company_bk
    ,yearno='Year'
      *company_type_code='Institutgroup'
      *original_currency='Curr'
      *period_name='Period'
      all='Total'
    ,all='Total'
      *epifp
    ;
run;

proc tabulate data=s_18  format=nlnum32. out=s_18_CF;
  by Company_Name company_bk;
  class original_currency yearno company_type_code period_name typeno;
  var   epifp;
  table 
    yearno='Year'
      *company_type_code='Institutgroup'
      *original_currency='Curr'
      *period_name='Period'
      all='Total'
    ,all='Total'
      *epifp
    ;
run;

 

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 3 replies
  • 948 views
  • 4 likes
  • 3 in conversation