Hi all,
I'm developing a dashboard that shows payments to clients from multiple suppliers. One of the data sets contains individual payment details (Supplier -> Client) and that is linked to a notes dataset that shows any notes that staff have entered in about the individual payments. I have the notes popping up in a window when the user double clicks a payment in a table.
The users have asked if I can, from the dashboard, create a link or button to download a PDF file showing all notes associated with payments in one file based on the report filters. The report filters are Suppliers ID/Name and Date Range.
Ideally I'd have, for each payment, the details of the payment followed by the note in date order. Is this possible?
I'm thinking if I can create the PDF code in SAS Portal then pass parameters to the Portal from SAS VA it would work? Preferably it would use the same data sets so I wouldn't have to replicate them?
Any pointers really appreciated!
As a side question does anyone know how to get SAS VA to honour line breaks in long text fields?
It sounds like you are looking for a way to create a PDF file that contains the payment details and notes for a specific set of payments based on certain filters (e.g. supplier ID and date range). In SAS, you can use the PROC REPORT
procedure to create a report containing the payment details and notes, and then use the ODS PDF
statement to save the report as a PDF file.
Here is an example of how you might do this in SAS:
PROC REPORT DATA=mydata;
WHERE supplier_id IN (123, 456, 789) AND payment_date BETWEEN '01JAN2022' AND '31DEC2022';
COLUMNS payment_id, payment_date, payment_amount, notes;
DEFINE payment_id / GROUP;
DEFINE payment_date / ORDER;
DEFINE payment_amount / SUM;
DEFINE notes / DISPLAY;
BREAK AFTER payment_id / SKIP;
COMPUTE after payment_id;
LINE 'Notes:';
ENDCOMP;
COMPUTE after notes;
LINE @2 '--------------------------------';
ENDCOMP;
RUN;
ODS PDF FILE='payment_notes.pdf';
PROC REPORT DATA=mydata;
WHERE supplier_id IN (123, 456, 789) AND payment_date BETWEEN '01JAN2022' AND '31DEC2022';
COLUMNS payment_id, payment_date, payment_amount, notes;
DEFINE payment_id / GROUP;
DEFINE payment_date / ORDER;
DEFINE payment_amount / SUM;
DEFINE notes / DISPLAY;
BREAK AFTER payment_id / SKIP;
COMPUTE after payment_id;
LINE 'Notes:';
ENDCOMP;
COMPUTE after notes;
LINE @2 '--------------------------------';
ENDCOMP;
RUN;
ODS PDF CLOSE;
In this example, the PROC REPORT
statement creates a report that includes the payment details and notes for payments made by the specified suppliers within the specified date range. The ODS PDF
statement is used to save the report as a PDF file named payment_notes.pdf
.
If you want to pass parameters from SAS VA to SAS Portal, you can do so using the SASVA
function in SAS Portal. This function allows you to access the current value of a SAS VA parameter from within a SAS Portal report. For example, if you have a SAS VA parameter named p_supplier_id
that contains the ID of the selected supplier, you can use the following code in SAS Portal to access the value of that parameter:
data _null_;
supplier_id = SASVA('p_supplier_id');
run;
You can then use the supplier_id
variable in your PROC REPORT
code to filter the payment data based on the selected supplier ID.
I hope this helps! If you have any other questions, please let me know.
And answer to your side question.
Yes, SAS Visual Analytics (VA) has a built-in option for displaying line breaks in long text fields. To enable this option, follow these steps:
This option will cause SAS VA to display line breaks in the long text field as actual line breaks, rather than displaying the entire text as a single line.
If you want to control the line breaks more precisely, you can use the PUT
function in SAS to insert line breaks into the text at specific points. For example, if you have a character variable named mytext
that contains long text, you can use the following code to insert a line break after every 50 characters:
mytext = PUT(mytext, $char50.);
You can then use the mytext
variable in your SAS VA table or graph, and the line breaks that you inserted with the PUT
function will be displayed in the table or graph.
Hi, thanks so much for replying!
I'll definitely pursue the ideas re the interaction between VA and the portal - the SASVA function will be the key.
I'm not seeing the options you suggest for the formatting of the long text though? I'm using Release 8.5.1 and Viya V.03.05 - is this functionality a recent thing?
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
See how to use one filter for multiple data sources by mapping your data from SAS’ Alexandria McCall.
Find more tutorials on the SAS Users YouTube channel.