Recently in the SAS Community Library: SAS' @Sundaresh1 highlights a sometimes overlooked task when applying document embeddings for purposes of similarity-based search. Normalisation of vectors helps obtain relevant matches.
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
And that's a wrap for our spring edition of ESUG! 👏
What a great day of learning, knowledge exchange, and connecting with new and old friends. Here's what we had in store for everyone.
8:30am - 9:00am
Registration and Light Breakfast
9:00am - 9:05am
Welcome Remarks @dougd , ESUG President
9:05am - 9:15am
SAS Updates Alice Yuan, SAS Canada
A quick look at new developments in the world of SAS.
9:15am - 9:45am
A Snapshot of Quantile Regression Anamaria Savu, University of Alberta
Quantile regression is a type of regression that models the conditional quantiles of a response variable on predictor variables. Unlike ordinary least squares (OLS) regression, which models the conditional mean of the response variable given the predictor variables, quantile regression allows to model separately different quantiles (such as the median, quartiles, or any other percentile) of the response variable.
She will discuss the advantages of quantile regression through examples. At the same time I will demonstrate how PROC QUANTREG can be used to perform quantile regression.
9:45am - 10:15am
Tips & Tricks
A Forest of Decisions: Navigating Complexity with Random Forest using SAS 9.4 Anthony Wu, Government of Alberta
Random Forest is a powerful ensemble learning technique widely used in machine learning for classification and regression tasks This presentation will explore some practical implementations of Random Forest in SAS 9.4, showcasing its effectiveness in predictive analytics and model building across various domains.
10:15am - 10:40am
Networking Break
10:40am - 11:10am
Automated Processing of Web-Based Research Data Using Proc HTTP and Macro Variable Lists @rickwatts , Women and Children's Health Research Institute
Rick and team use a web based system called REDCap to collect medical research data from study participants. A single REDCap system houses many thousands of projects, each of which can be designed and modified by individual researchers. This is a very dynamic data environment with project level data structures continually changing. Any such change is reflected in data extracts resulting in frequent re-writes of existing SAS code.
To address this challenge Rick has written a large lump of ugly SAS code that uses PROC HTTP to extract project data via REDCap’s RESTFUL API. System metadata allows REDCap concepts to be mapped to SAS data types, variable names, labels and formats before data is extracted and processed into individual, study specific data sets.
11:10am - 11:55am
Integrating Synthetic Data Generation in Machine Learning Modeling Pipelines @BrettWujek & @Sundaresh , SAS
Synthetic data generation is increasingly important for augmenting existing data sets, mitigating imbalance in data sets with rare events and enabling data science tasks without having to share sensitive real data. In this presentation, we show how to use SAS® analytical capabilities to efficiently generate high-quality synthetic data. We demonstrate the use of SAS procedures, a REST API in Python, related pre-processing and post-processing steps, as well as assessment metrics.
11:55am - 12:00pm
Closing Remarks
If you have a presentation idea for our next meeting, please let us know. See you at the next one! 😃
... 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