BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Sukhi1
Calcite | Level 5

Proc summary data = LIB_TRN.FFMSUB_SELECTED_1804 nway missing;
  by gpnr crms_org_id;
  var prov_num;
  output out= LIB_TRN.FFMSUB_SELECTED_AGG_1804(drop = _:)
  sum= maxid(prov_num(gpnr crms_org_id reporting_period db_filialnummer
       db_kontonummer ccdb_id kategorie gpname gbmerker
       nachrichtlich))=;
quit;

WARNING: Variable gpnr already exists on file LIB_TRN.FFMSUB_SELECTED_AGG_1804.
WARNING: Variable crms_org_id already exists on file
         LIB_TRN.FFMSUB_SELECTED_AGG_1804.
WARNING: The duplicate variables will not be included in the output dat
         the output statement number 1.

 

Please help me to remove this warning .

1 ACCEPTED SOLUTION

Accepted Solutions
Astounding
PROC Star

The problem your code creates is that you are using these variables for two different purposes:  GPNR and CRMS_ORG_ID.  They are both part of the BY statement and part of the MAXID clause.

 

I can't see a reason to keep them in the MAXID clause, when they are already part of the BY statement.

View solution in original post

4 REPLIES 4
RW9
Diamond | Level 26 RW9
Diamond | Level 26

Please help me reAD ySmiley HappyR code .  Easy to read code is not optional, it is key for anyone else looking at it.  Several tools are made available for to post code, use the code window - its the {i} above the post area, this keeps code formatting and doesn't put smiley faces in for instance.  Also, avoid coding in mixed case, thats not how you read a book.

 

You can try the autoname and autolabel options.  Basically the warning is telling you that the variable being created from the sum already exists as a variable in the dataset, so you need to give it another name.  The autoname should add sum_ to the name.

proc summary data=lib_trn.ffmsub_selected_1804 nway missing;
  by gpnr crms_org_id;
  var prov_num;
  output out=lib_trn.ffmsub_selected_agg_1804 
  sum=maxid(prov_num(gpnr crms_org_id reporting_period db_filialnummer
                     db_kontonummer ccdb_id kategorie gpname gbmerker
                     nachrichtlich))= / autoname autolabel;
quit;

 

Sukhi1
Calcite | Level 5
Thanks for you suggestion.I will keep in mind from now onwards. Yes I did try autoname and autolabel but it created new variable gpnr2 and crms_org_id2. May be I have gpnr and crms_org_id in "by" statement also. Anyway I removed it from maxid(variable list) now it is fine. Thanks.
Astounding
PROC Star

The problem your code creates is that you are using these variables for two different purposes:  GPNR and CRMS_ORG_ID.  They are both part of the BY statement and part of the MAXID clause.

 

I can't see a reason to keep them in the MAXID clause, when they are already part of the BY statement.

Sukhi1
Calcite | Level 5
Yes. I did removed it from MAXID clause and it worked fine. Thank you.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 1715 views
  • 0 likes
  • 3 in conversation