BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
saikiran_nemani
Obsidian | Level 7
PROC TRANSPOSE DATA=FINAL2
   OUT = FINAL3 ;
     BY LOAN_NO;
     ID new_date1;
     VAR INSTL_AMOUNT;
RUN;
 
ERROR: The ID value "NOV2023" occurs twice in the same BY group.
 
Can anyone help on above issue ?
1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

What it says. You have at least one LOAN_NO group where the NEW_DATE1 value "NOV2023" appears more than once.

For TRANSPOSE to work, you have to de-duplicate the dataset first, so you have to make a decision what you do with the INSTL_AMOUNT values: take only one, sum, maximum, minimum, mean.

Since a wide dataset will not be suited for further analysis, I suspect you need this for reporting purposes, so you should look at PROC REPORT first, as it can handle all this at once (use NEW_DATE1 as an ACROSS variable).

proc report data=final2;
column loan_no instl_amount,new_date1;
define loan_no / group;
define instl_amount / "" analysis sum;
define new_date1 / "" across;
run;

View solution in original post

2 REPLIES 2
Kurt_Bremser
Super User

What it says. You have at least one LOAN_NO group where the NEW_DATE1 value "NOV2023" appears more than once.

For TRANSPOSE to work, you have to de-duplicate the dataset first, so you have to make a decision what you do with the INSTL_AMOUNT values: take only one, sum, maximum, minimum, mean.

Since a wide dataset will not be suited for further analysis, I suspect you need this for reporting purposes, so you should look at PROC REPORT first, as it can handle all this at once (use NEW_DATE1 as an ACROSS variable).

proc report data=final2;
column loan_no instl_amount,new_date1;
define loan_no / group;
define instl_amount / "" analysis sum;
define new_date1 / "" across;
run;
Cayden
Calcite | Level 5

I've encountered the "Proc ID Transpose Issue" before, and it can be quite frustrating. Make sure to double-check your data formatting and variables. If you need help, there are some useful resources online like essay app https://essaypro.app/ to troubleshoot this problem.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

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
  • 2 replies
  • 422 views
  • 0 likes
  • 3 in conversation