BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Dhernaam
Calcite | Level 5

Hey guys!

I'll try my best to explain my current problem, maybe someone has any idea on how to approach this:

To make it short, I will call SAS Enterprise Guide 8.3 "SAS EG" and SAS Visual Analytics 7.4 "SAS VA".

 

Current data flow:

  • SAS EG: Treats and uploads a dataset.
  • SAS VA: Reads that dataset, and shows a dashboard.
  • SAS VA: Using the integrated distribution, sends an email with the dashboard to some users.

Problem:

  • Sometimes some fields of the dataset are empty. When that happens, we would not want to send the email distribution.

Approach:

  1. Try to validate if the fields are empty on SAS VA so we don't send the distribution. Doesn't seem possible. It just lets you change scheduling.
  2. Try to migrate the SAS VA Dashboard to SAS EG, so we can easily check the empty fields and send the mail trough SAS EG. Possible, but it would take lots of time to replicate the dashboard.
  3. Try to find a physical script/file that "runs" the Visual Analytics distribution. We could validate the empty fields on SAS EG, and call that script from SAS EG. I've searched all arround the SAS folders, but I can't seem to find any actual file. I've found it on the SAS Management Console, but I can't "call" it from SAS EG.

Does anyone has any idea on how to solve this?

Thank you very much!

1 ACCEPTED SOLUTION

Accepted Solutions
Stu_SAS
SAS Employee

Since report distribution is based on time rather than event, one idea you could have is to distribute the report through SAS by email. All you'll need is the link to the report. Visual Analytics 7.4 links can be easily obtained by going to the menu, selecting "Email," and copying the link. In Visual Analytics 7.5 and later, it's under "Copy Link."

 

The only downside to this method is that you cannot include a pdf attachment, but you can at least alert people that new valid data has been added to the report.

 

To send an email through SAS, use the email filename access method. We'll call the email code to run only when all rows are populated.

/* Email configuration */
%let to     = email_list@company.com;  *Space-separate additional email addresses;
%let from   = no-reply@company.com;
%let report = %nrstr(REPORT LINK HERE);

/* Check number of missing rows for a column */
proc sql noprint;
    select nmiss(column)
    into :nmiss
    from have
    ;
quit;

/* Only send an email if column is not missing */
%macro sendEmail;
    %if(&nmiss. LE 0) %then %do;
        filename mailbox email
            to      = ("&to.")
            from    = "&from." 
            subject = "Report data has been updated"
        ;

        data _null_;
            file mailbox;

            put "New data has been added to the report.";
            put "Report URL: %superq(report)";
        run;
    %end;
%mend;
%sendEmail;

As a side note, if you go to SAS Viya, you can pull images of a report through the Viya REST API.

 

View solution in original post

2 REPLIES 2
Stu_SAS
SAS Employee

Since report distribution is based on time rather than event, one idea you could have is to distribute the report through SAS by email. All you'll need is the link to the report. Visual Analytics 7.4 links can be easily obtained by going to the menu, selecting "Email," and copying the link. In Visual Analytics 7.5 and later, it's under "Copy Link."

 

The only downside to this method is that you cannot include a pdf attachment, but you can at least alert people that new valid data has been added to the report.

 

To send an email through SAS, use the email filename access method. We'll call the email code to run only when all rows are populated.

/* Email configuration */
%let to     = email_list@company.com;  *Space-separate additional email addresses;
%let from   = no-reply@company.com;
%let report = %nrstr(REPORT LINK HERE);

/* Check number of missing rows for a column */
proc sql noprint;
    select nmiss(column)
    into :nmiss
    from have
    ;
quit;

/* Only send an email if column is not missing */
%macro sendEmail;
    %if(&nmiss. LE 0) %then %do;
        filename mailbox email
            to      = ("&to.")
            from    = "&from." 
            subject = "Report data has been updated"
        ;

        data _null_;
            file mailbox;

            put "New data has been added to the report.";
            put "Report URL: %superq(report)";
        run;
    %end;
%mend;
%sendEmail;

As a side note, if you go to SAS Viya, you can pull images of a report through the Viya REST API.

 

SASKiwi
PROC Star

It seems to me that you are using EG to regularly prepare and load data into SAS VA. How often are you doing this? Daily, weekly or some other interval?

 

We have a similar setup to you. EG 8.3 and SAS VA 7.5. We have daily and monthly jobs updating SAS VA. However we use SAS Management Console to schedule and run those regular jobs rather than using EG. Is there any reason why you don't have access to SMC? It's a far better and more reliable tool for running regular SAS jobs as all of the processing is server-based and not reliant on a PC.

 

Also there's no problem sending conditional emails as part of the data preparation as explained by @Stu_SAS

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 2 replies
  • 556 views
  • 3 likes
  • 3 in conversation