BookmarkSubscribeRSS Feed
sc5
Obsidian | Level 7 sc5
Obsidian | Level 7

 

I have a report (e.g. below) where a set of list controls control the data used in the scatter plot and a simple univariate linear regression. 

 

The table below has some reference x values, and the "Predicted" column is derived from the linear regression (right click on object, "Derive predicted", and included as an item in the dataset, avg. aggregation.) 

 

The linear regression itself updates whenever I select/deselect any item in the controls. 

But the 'Predicted' values are the values from the initial version of the regression from which I created the field. 

 

Is there any way to get the predicted y values from the regression updating dynamically and displayed in the report below? It should change whenever I change the list control selection. 

 

I just want the report viewer to be able to see the estimated y values at certain x values as they slice data in different combinations. 

 

sc5_0-1714609271858.png

 

 Thank you!

8 REPLIES 8
Stu_SAS
SAS Employee

Hey @sc5! When you derive predictions from a modeling object, you are effectively generating the score code for that model. As an analogy, it would be like saving the coefficients and putting them in a DATA Step for prediction. As a result, the predicted values that you get are based on the model that you built at the time you selected "Derive Predicted." Your model will dynamically change, but the derived predicted values are static until you derive new predictions.

 

I would recommend putting a product request for this feature. Effectively it sounds like what you want to do is have the ability to derive predictions from the most recent model that has been added and have it auto-update the derived predictions - that is, whenever the model changes, so do those predictions. Note that for some models that are non-deterministic, predictions will change when data is reloaded.

sc5
Obsidian | Level 7 sc5
Obsidian | Level 7

Hi @Stu_SAS, thank you for replying!

 

Do you know if I can feed data from a report (filtered by list controls) as an input to a stored job/process and display the outputs back in the report?

i.e. if I save a proc reg script / macro somewhere, can I then trigger it with a button in the report to run the regression on the data (as filtered at that instant in the report) and output the coefficients or predicted values to a dataset that can then be refreshed in the report? 

 

E.g. Below is an example in Excel where I select the slicers and the regression values change instantly in the table (2 screenshots)

 

sc5_2-1714726680195.pngsc5_3-1714726696616.png

 

In Excel this is pretty simple for 1-D regressions with the formulas = intercept() and =slope() on the data columns. 

 

I'd be happy to try a more complex workaround in SAS VIYA if it's possible to store a script somewhere that can be made to act on data filtered at any moment in a report though, since I could then use this to do more complex analysis than what's possible in Excel. 

 

Thank you! 

Stu_SAS
SAS Employee

You sure can! There are a number of ways to do this, but it sounds like you'd most likely be interested in using a Viya Job with a Data Driven Content object. Check out @Renato_sas's article about using jobs with Data Driven Content. It's a great way to pass data, filters, and parameters down to jobs which can then interact with the data directly.

 

https://communities.sas.com/t5/SAS-Communities-Library/Introduction-to-Integration-of-SAS-Visual-Ana...

 

If you're curious about how to get that data to update in real-time, check out this SGF 2021 paper:

https://communities.sas.com/t5/SAS-Global-Forum-Proceedings/Modernizing-Scenario-Analysis-With-SAS-V...

 

@acordes showed a great DDC example that passed parameters into a Viya Job with VA controls and then ran some IML code to create new data for scoring.

 

sc5
Obsidian | Level 7 sc5
Obsidian | Level 7

These links are very helpful, thank you! I'm currently on a trial version of SAS VIYA and I'm having some issues getting the examples to work, though. 

 

e.g. HelloSmallWorld.
When I try to replace <your.host.name> with the trial environment URL in the examples from those links, it can't find the link.

My trial url looks like "https://<trial.host>.my-trials.sas.com/".

I can only create folders under sasdrive -> users -> <email address> -> my folder.

So I've created a folder /users/<email address>/my folder/github where I've unzipped the examples in those links.

But when I try to replace  <your.host.name/github> in the html job form with "<trial.host>.my-trials.sas.com/users/<email address>/my folder/github" as instructed, and create my report, I get the error below in the DDC object. 

Is there some other way I should be linking to files in the trial environment? 

sc5_0-1714958235227.png

Thank you!

@Renato_sas @Stu_SAS 

Stu_SAS
SAS Employee

I believe the trial environments are behind a firewall and might not be able to talk to the outside world. There is a chat icon in the trial environment where you can get support to help out. This is the best and fastest place to go. Alternatively you can email support@sas.com and they can help you.

sc5
Obsidian | Level 7 sc5
Obsidian | Level 7

Thank you! I'm in touch with SAS and will see if we can sort it out. 

Meanwhile, I just wanted to confirm again - the only way to perform and display any kind of dynamic calculation from sliced data is via HTML job forms that call JavaScript functions? 

Wanted to check because our aim is to evaluate whether SAS VIYA Visual Analytics can be used as a GUI / interactive tool for data science / data analysis. 

If this is the only way to do any kind of calculation / 1D regression on data in a visual report, that would mean we would need to learn JavaScript and HTML in addition to SAS (which we already use) to build dashboards, which we currently do with a little VBA / just formulas in Excel (example screenshots in my first reply).
e.g. as list controls are used to filter in a new subset of data, display predicted values and other derived calculations for that new subset of data updating in real time. 

Thank you for your time and patience! 

sc5
Obsidian | Level 7 sc5
Obsidian | Level 7

Addition / update: Apparently we don't have access to add .js files to the webserver, we can only store files in the SAS content server, so this doesn't work.

Is there any way at all to pass parameters to a SAS Job without JavaScript? I don't even necessarily need to pass filtered data through to the job, if I could just pass multi-value character parameters from a VA report to a SAS Job that would be great and would help a lot. Then I can just connect my list controls to those parameters.

I know there are task prompt jobs like the 'Dynamic Prompts Using CARS Data' sample job provided that I can add to a DDC/Job Content object. If I use that method, I'd be looking for a way where those prompt parameters can either
a. simultaneously also act on other graphical / plot objects, or
b. get their values directly from defined parameters/list controls that are also linked to other chart objects.

Is that possible?

 

Also, would it be possible to see the 2 example reports from this link? Modernizing Scenario Analysis With SAS Viya and SAS Visual Analytics

The 2nd one especially seems to be dynamically connecting parameters to a job like I want to, but the GitHub doesn't have any .js or HTML or JSON files and it's a bit difficult to see how it's actually interfacing with the report.

I also can't see the full list of parameters required and how they're set up to simultaneously work on the DDC and the visuals. 


Thanks a lot!! 

Stu_SAS
SAS Employee

At this time there is not a way to pass parameters to a Viya Job without going through Java Script with Data Driven Content. Viya does include a number of statistics and machine learning objects which you can interact with controls/filters, but you are unable to see raw predictions in real time if you add those filters. As a result, the only way to see changes to raw predictions from models is to build them into a Viya Job that pulls the values of filters from Data Driven Content.

 

The first report is available on GitHub. A JSON package to import it is here. I'll tag @acordes to see if it's possible to provide an example report for his example of using Data Driven Content to run a job.

 

What you are describing is a great idea for VA. I'll run it by our R&D team.

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
  • 8 replies
  • 921 views
  • 0 likes
  • 2 in conversation