Creating an AI Assistant for SAS Viya in 5 steps (@sassoftware/viya-assistantjs) - Part I
Recent Library Articles
Recently in the SAS Community Library: SAS' @kumardeva debunks the myth that developing AI assistants is too hard. He shows you how to use the @sassoftware/viya-assistantjs library to jump start your development.
Hi All,
Could anyone help me with the below requirement?
I have 3 variables SUBJ CODE TRT which have values as following.
SUBJ CODE TRT
1001 AB A
1001 AB B
1002 CD C
1002 CD C
1003 EF E
1003 EF F
In the above data for each SUBJ there is a specific code which have corresponding TRT vales as A and B. Example, for SUBJ 1001, code is AB and TRT is having 2 records for same SUBJ and CODE with A in 1 row and B in next row. If it is 1002 then the 2 TRT records should be C and D, but if it C and C then it should be flagged. See below expectation.
SUBJ CODE TRT FLAG
1001 AB A 0
1001 AB B 0
1002 CD C 0
1002 CD C 1
1003 EF E 0
1003 EF F 0
1004 AD A 0
1004 AD A 1
Can anyone help me achieve this?
... View more
Hello members, I am seeking the most efficient solution or examples to output percentages of response categories in a tabular format for an opinion survey using the answer categories and specifications further below,. Any feedback or code would be greatly appreciated, especially for the the most and least positive answer categories. The metric, Score0-100 is calculated by assigning a higher weight to more positive responses. In this way, the higher the Score0-100, the more positive the result. Across the questions with a five-point response scale, the most positive response is assigned a weight of 100, the second most positive response is given a weight of 75, the third most positive response is given a weight of 50, the second least positive response is assigned a weight of 25 and the least positive response category is given a weight of 0. When Score 0-100 is provided for a group, the average score is calculated across respondents in that group. For example, if there were 20 respondents in a group, the Score0-100 for each person would be summed and divided by 20 to give the average of the Score0-100. SCORE100 is calculated by removing the DK and NA, and then attributing a score of… 100 to the most positive answer category 75 to the second most positive answer category 50 to the neutral category 25 to the second most negative answer category 0 to the most negative answer category
... View more
Hi, I have been working on a SAS VA report with a custom graph. Printing the report with the standard functionality "PDF Export" works but delivers terrible output. So I took the challenge to generate the pdf in a job (Job Execution) where I receive parameters from the report itself, subset the data and create a nice pdf-file, ready to be downloaded with a click. This all works. The only thing missing is an image of the custom graph. So I have been studying the REST API's, very interesting. I am now able to generate an image of the graph but that's where it ends, and that's where my question starts.. This is a snippet of the code I use to create a job to capture an image of my custom graph. filename jobresp temp;
proc http
method=POST
url="&BASE_URI./reportImages/jobs"
oauth_bearer=sas_services
in="{
""version"":3,
""reportUri"": ""&report_uri"",
""layoutType"": ""normal"",
""selectionType"": ""visualElements"",
""visualElementNames"": ""ve22789"",
""imageType"":""png"",
""size"": ""1200x800"",
""refresh"": true
}"
out=jobresp;
headers
"Accept"="application/vnd.sas.report.images.job+json"
"Content-Type"="application/vnd.sas.report.images.job.request+json";
debug RESPONSE_BODY OUTPUT_TEXT;
run; After submitting the job I'm able to get the image with this code: filename rsvg temp;
proc http
method=GET
url="&BASE_URI./%trim(&image_uri)"
out=rsvg
oauth_bearer=sas_services;
headers
"Accept"="image/svg+xml";
run; This all works. An svg-file is generated and I can view it in the browser but the image is not added in my pdf. This is where my questions begin: The filename reference is to a temp-file. I don't know how to reference this filename in my "ods pdf"-code. To work around this, I have saved the image in my work, but still the image is not added to the pdf. How can this be done? The error I get is something like: image GT00/f100 is not found. Since the svg-file is an xml-document it somewhere in the code finds this GTxx/xxx-code. Do I really need to convert it in someway? I am not able to generate a PNG-file as a workaround, even though I add "imageType: png" to the call. This doesnt seem to work, it keeps spitting SVG. I have tried other api-calls but this endpoint is the only one working for me. For example, everything beginning with "&base_uri/visualAnalytics" doesnt work here. Is this because I'm working with viya 3.5? The error-message is something like: http 404, sas va nog found on this server. But the rest of the api's work. FILENAME vaJason TEMP;
/* FILENAME hdrout TEMP; */
PROC HTTP
METHOD="GET"
oauth_bearer=sas_services
out=vaJason
URL = "&BASE_URI/visualAnalytics/";
HEADERS "Accept" = "application/vnd.sas.api+json";
/* debug RESPONSE_BODY OUTPUT_TEXT; */
debug level=3;
RUN;
LIBNAME vaJason json; This is a piece of the code I use to output to ODS PDF. data _null_;
a=pathname('work');
call symput('tt',strip(a));
run;
filename
f_pdf
filesrvc parenturi="&SYS_JES_JOB_URI"
name='_webstream.pdf'
contenttype='application/pdf'
contentdisp="attachment; test.pdf"
;
ods pdf file=f_pdf;
ods escapechar='^';
options nodate nonumber orientation=portrait;
ods pdf text='^S={just=center font=("Verdana",8PT,Bold Italic)}Test pdf';
Title j=l "^{style[preimage=""&tt./test1.svg""]}";
proc print data=sashelp.cars(obs=3) noobs;
run;
ods pdf close; A lot of this works but I cannot seem to add an image. And even when this works I still have another problem with all this. The datasources used are genereated in the Job Execution and stored in the CASUSER. When I developed the report the datasources were linked to casuser(dennis.remy@ilent.nl). I had to change this to casuser for others to be able to work with the report. But after changing this (what was very dificult because I was not able to do his under my own account, even though I created the report, I had to ask a collegae to change this), the http-call returns an error that the datasources are not accessible. So this, for now, only works with an old version of the report where the lib datasource is still casuser(dennis.remy@ilent.nl). But thats another problem. I hope someone has the knowledge to help me with my first problem. Thanx a lot!
... View more
Hi, do you guys ever work with Verhoeff check digit algorithm (https://en.wikipedia.org/wiki/Verhoeff_algorithm) with SAS? I am trying to use sas for verhoeff check digit but havent found any script to do so.
... View more
Watch this Ask the Expert session to learn the flexibility, efficiency and scalability of combining SAS Event Stream Processing with ONNX Runtime and Microsoft Azure, addressing common challenges in AI model deployment and execution.
Watch the webinar
You will learn to:
Streamline AI project workflows by integrating SAS Event Stream Processing with ONNX Runtime and Microsoft Azure.
Integrate ONNX Runtime with SAS Event Stream Processing to create real-time streaming analytics with simplified testing and deployment on a variety of hardware alignments.
Jump-start projects with sample projects and code examples on GitHub to deploy ONNX models efficiently and effectively.
The questions from the Q&A segment held at the end of the webinar are listed below and the slides from the webinar are attached.
Q&A
What use cases does this solution provide the most value for?
This question is not easy to answer because there are so many use cases. This presentation was just a selection of a few, but I think it’s particularly useful in computer vision. For example, if you need to not only identify objects but also apply further logic and scale up, this solution can handle multiple cameras across that location. We also have use cases with deployments in multiple different geographic locations, allowing us to manage several factories—about 40 factories with hundreds of cameras each—centrally. This flexibility lets you define your specific needs, because no two businesses are the same.
For instance, in some scenarios, we need to identify vehicles in specific factory spaces, while in others, we need to alert workers' safety. Worker safety is a particularly interesting use case with significant implications for improving employee habits and ensuring a safer workspace. This solution helps to easily spot unsafe behaviors and can be quickly customized for the specific needs of different factories.
For example, we have LOTO (lockout-tagout) deployments that verify the dangerous equipment is properly shut off and not able to be started again prior to completion of the task. We receive sensor feedback from the machinery, so we know if the system is verified safe, or if the conveyor belt is moving. And the best part is, all this is possible without needing to change your existing infrastructure. You can use what is already in place, and this solution complements and enhances your current setup, allowing you to apply the necessary logic.
How can I learn more?
We highly recommend reaching out via email to iotcontact@sas.com. This way, you can get a trial license and use the Azure Marketplace as a very easy way to deploy SAS Event Stream Processing and experiment with it. You'll find a comprehensive list of examples available for download at the welcome screen, covering various use cases such as computer vision object detection.
For further examples, you can refer to our GitHub repository, where you can easily get the code. We also have an online community where you can ask questions and get direct feedback from developers. All these links are on the slide deck provided. We’re very welcoming and happy to assist you.
Recommended Resources
SAS Event Stream Processing Homepage
About SAS
ONNX runtime
Microsoft Azure
Please see additional resources in the attached slide deck.
Want more tips? Be sure to subscribe to the Ask the Expert board to receive follow up Q&A, slides and recordings from other SAS Ask the Expert webinars.
... View more