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,
I am trying to filter some of my data and create a new dataset. using the following syntax:
data YYY; set XXX; if DeathCause_ICD in ("A923", "A9231","A9232","A9239") THEN disease1=1; IF condition_rec_1 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_2 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_3 in ("A923", "A9231","A9232","A9239") then disease1=1; IF condition_rec_4 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_5 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_6 in ("A923", "A9231","A9232","A9239") then disease1=1; IF condition_rec_7 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_8 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_9 in ("A923", "A9231","A9232","A9239") then disease1=1; IF condition_rec_10 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_11 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_12 in ("A923", "A9231","A9232","A9239") then disease1=1; IF condition_rec_13 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_14 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_15 in ("A923", "A9231","A9232","A9239") then disease1=1; IF condition_rec_16 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_17 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_18 in ("A923", "A9231","A9232","A9239") then disease1=1; IF condition_rec_19 in ("A923", "A9231","A9232","A9239") then disease1=1; if condition_rec_20 in ("A923", "A9231","A9232","A9239") then disease1=1; else delete; RUN;
While I am not receinving any error in the log, still my syntax not working and giving me 0 observations.
I have used this syntax multiple times and i canot figure out wher it is going wront. any thoughts appreciated.
... View more
Hi , I have SAS jobs in SAS EG. For each job, I would like to have related output tables (after Table Loader Step). E.g. I have a JOB_A with two output (TABLE_A & TABLE_B) I would like to have something like: JOB_A | TABLE_A JOB_A | TABLE_B I don't know how to perform this with SAS code? Can you help with this? Thanks
... View more
Hi! I have a split plot with two factors in the split. I need to know how to write the repeated statement for the residuals in the model. I have two treatments (active vs placebo). Patients are nested within treatment. The whole plot is treatment (t-1)=1 df patient(treatment) t*(p-1)=2p-2 df which is the random effect residual for the whole plot effect of treatment. The split plot has factors week and segment. We are measuring 112 segments within patients' eyes at several timepoints (week variable). Each eye is divided up on scans into 56 parts. Everyone's eyes are divided the same way. At first I thought this was subsampling of the patient for examining the effect of treatment. But there is no randomization of segments being sampled and they are exactly the same across all patients. So, we have patients being blocks for both week and segment. The effects in the split plot are week (w-1) df treatment*week (t-1)(w-1) df segment (s-1) df treatment*segment (t-1)(s-1) treatment*segment*week (t-1)(s-1)(w-1) and the residual error term The error term seems to be segment*patient(treatment) + week*patient(treatment) + segment*week*patient(treatment). We have no interest in the segment effect. We are interested in treatment and week and treatment*week effects. I believe the proc mixed call would have the following two random statements which assume a common variance between the two treatments. Random patient(treatment); Random week*patient(treatment); What would the proc mixed repeated statement be for defining the residual error? Thank you for your help! Alan
... 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
I have not been on this site for a bit. I was visiting today and have a few questions: 1. I have a friend who is new to sas programming but he is not getting challenged at his sas job. He asked me today for advice on how gain better programming experiences. He's a statistical programmer and has aspiration to be a biostatistical programmer eventually. He works for a Contract Research Organization (CRO). Initially, I thought SAS had programming challenges but I couldn't find them. I think I personally attended one once during a sas forum a few years ago. Does SAS have plans for quarterly programming challenges for the community? 2. Also, He wanted to search the SAS papers for programming tips but I couldn't find a place with everything. Also, I need to find any papers related to Digital Twins. Any help for these two questions? Thanks in advance.
... View more