The LITI rule for Text Analytics that you didn’t know you needed…until now!
Recent Library Articles
Recently in the SAS Community Library: Customer complaint call transcripts can end up being quite verbose. SAS' @PeterChristie reveals how to distill relevant info using SAS Text Analytics.
I tried: ... sas.exe myfile.sas7bdat without success. I.e., I like to open a .sas7bdat file from the command line similar to how Windows opens SAS when double-clicking on a .sas7dbat file in Windows Explorer. Thank you.
... View more
Given the SAS data set SASDATA TWO: SASDATA TWO XY - - - - The following SAS program is submitted: data sasuser.one two sasdata.three; set sasdata two; if x = 5 then output sasuser.one; else output sasdata two; run; What is the result? A. data set SASUSER.ONE has 5 observations data set SASUSER. TWO has 5 observations data set WORK. OTHER has 3 observations B. data set SASUSER.ONE has 2 observations data set SASUSER. TWO has 2 observations data set WORK.OTHER has 1 observations C. data set SASUSER.ONE has 2 observations data set SASUSER. TWO has 2 observations data set WORK.OTHER has 5 observations D. No data sets are output. The DATA step fails execution due to syntax errors.
... View more
I have recently started to make some reports about the reports within our Viya 4 environment using the documentation I could find and have basically succeeded to retrieve the information we need. However, what I have not been able to find is whether there is a way to limit the items returned when doing an API call.
For example within the PI Web API it is possible to use the "selectedFields" parameter. I have not been able to find a similar parameter within the documentation for the SAS Viya REST API, therefor my question: Is such a parameter available?
For example to use an URL like: &BASE_URI/folders/folders/&uri/members?start=0&limit=10&selectedFields=items.name,items.id Which would give me only the name and id field from the items "table"
... View more
Hello, so I was working on this macro to print the results of the id and each variable in a dataset if it is empty.
%macro filter_and_print(dataset, new_dataset, var_id);
%local dsid varnum varname vartype filter_condition;
/* Open the dataset */
%let dsid = %sysfunc(open(&dataset));
/* Check if dataset is opened successfully */
%if &dsid %then %do;
/* Get the number of variables in the dataset */
%let varnum = %sysfunc(attrn(&dsid, nvars));
/* Loop through variables */
%do i = 1 %to &varnum;
/* Get variable name and type */
%let varname = %qscan(%sysfunc(varname(&dsid, &i)), 1);
%let vartype = %sysfunc(vartype(&dsid, &i));
/* Determine filter condition based on variable type */
%if &vartype = C %then %do;
%let filter_condition = %sysfunc(quote(&varname)) = ' ';
%end;
%else %if &vartype = N %then %do;
%let filter_condition = %sysfunc(quote(&varname)) = .;
%end;
/* Create filtered dataset */
data &new_dataset;
set &dataset;
if &filter_condition;
run;
/* Print filtered dataset */
proc print; var &var_id &varname;
run;
%end;
/* Close the dataset */
%let dsid = %sysfunc(close(&dsid));
%end;
%else %put ERROR: Unable to open dataset &dataset;
%mend;
Right, so it does loop through each variable, if it is a character variable it checks if there is an empty string, if it is a numerical variable it checks if it is equal to .
Okay, so in the log, I get messages like
But using proc contents on the original dataset, I do see that the variable in question is numerical.
And I see the Note that says character values have been converted to numerical, but why would it be doing that?
I wouldn't recommend running the program with a large dataset though as it does take a bit of time to fully execute. I do get my printed results at the end of running the program, however it does not print out the empty/missing values as expected. It instead returns every observation but filtered by the id variable and the variable being observed.
Any help would be greatly appreciated. Thank you! 😁
... View more