BookmarkSubscribeRSS Feed
SteveNZ
Obsidian | Level 7

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?

 

3 REPLIES 3
webart999ARM
Quartz | Level 8

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.

webart999ARM
Quartz | Level 8

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:

  1. In SAS VA, open the Properties pane for the table or graph that contains the long text field.
  2. In the Data section, click the Edit button next to the long text field.
  3. In the Edit Field dialog box, go to the Display section.
  4. Select the "Treat long text as multiple lines" option.

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.

SteveNZ
Obsidian | Level 7

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-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!

Tips for filtering data sources in SAS Visual Analytics

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.

Discussion stats
  • 3 replies
  • 851 views
  • 0 likes
  • 2 in conversation