BookmarkSubscribeRSS Feed
JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

I run the SAS code:

%macro LOBCode(lobname1,lobname2);

PROC SQL feedback;

/*CREATE TABLE Paid_Claims_Final&lobname1 AS */

CREATE TABLE Paid_Final&lobname1 AS

SELECT DISTINCT

CODE.LOB,

CODE.Category,

TEMP.Code AS Code,

TEMP.CODE_DESCRIPTION,

SUM(TEMP.Current_Payable) FORMAT=dollarx10.2 AS TOTAL_CURRENT_PAYABLE,

SUM(TEMP.Original_Payable) FORMAT=dollarx10.2 AS ORIGINAL_PAYABLE,

COUNT(TEMP.CLCL_ID) AS TOTAL,

STRIP(temp.MONTH) AS MONTH

FROM PAYMNT&lobname1 TEMP

INNER JOIN REWORKI.CODE CODE on Code.Code=TEMP.CODE

GROUP BY CODE.LOB,CODE.Category,TEMP.CODE,

TEMP.CODE_DESCRIPTION,

STRIP(temp.MONTH)

HAVING TEMP.Rework_Claim=1 AND CODE.LOB=&lobname2;

QUIT;

/************************************************************/

Proc Sort data=work.Paid_Final&lobname1 out=work.Paid_FinalSort&lobname1;

by LOB;

run;

/****************************************************************************/

PROC TRANSPOSE DATA=Paid_FinalSort&lobname1 OUT=Paid_Final&lobname1.TRANS (DROP=_NAME_);

ID MONTH;

BY LOB Category Code CODE_DESCRIPTION ORIGINAL_PAYABLE TOTAL_CURRENT_PAYABLE;

RUN;

%mend LOBCode;

 

Go tthe error message:

ERROR: Data set WORK.PAID_FINALSORT1300 is not sorted in ascending sequence. The current BY group has ORIGINAL_PAYABLE = $1.841,67

and the next BY group has ORIGINAL_PAYABLE = $49,49.

%LOBCode(1300,'1300');

 

Please see attach log file.

 

Thank

5 REPLIES 5
Astounding
PROC Star

So you sort the data set BY LOB.  What makes you think it would be in order:

 

BY LOB Category Code CODE_DESCRIPTION ORIGINAL_PAYABLE TOTAL_CURRENT_PAYABLE;

 

Did you mean to include a VAR statement in PROC TRANSPOSE?

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

If I sort by Month, might be worked.

 

Let me try.

 

 

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

Sort by month dse nto workign either...

 

not sure what should do.

 

 

Astounding
PROC Star

Well, you're doing the right thing.  You will have to fiddle with the code until you get something that works.  Just one suggestion:  get rid of all the macro language entirely.  Hard-code everything.  That gives you a chance of figuring out what the error messages mean.  Once you have a program that works, then you can worry about converting it to a macro.

JHE
Obsidian | Level 7 JHE
Obsidian | Level 7

ok, will do, thank you.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 1358 views
  • 2 likes
  • 2 in conversation