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
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?
If I sort by Month, might be worked.
Let me try.
Sort by month dse nto workign either...
not sure what should do.
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.
ok, will do, thank you.
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.
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.