Connecting to SAS Viya for Learners from a Remote Jupyter Notebook
Recent Library Articles
Recently in the SAS Support Community: A few weeks ago, SAS' @joeFurbee fielded a communiy question: "Can we connect SAS Viya for learners from macOS terminal via Python SWAT library?" His answer: Yes! In this post, he details how you can connect to SAS Viya using the SWAT package.
Competing in the 2024 SAS Hackathon Student Track and have questions? Or do you like to answer other fellow student questions? Then participate in the chat in this article!
... View more
Dear SAS Community,
I am trying to analyze multinomial dependent variables that have mostly zeroes. When I analyze these variables includíng the interactions of the factors in the model I am getting these warnings:
The negative of the Hessian is not positive definite. The convergence is questionable.
The procedure is continuing but the validity of the model fit is questionable
The specified model did not converge
However, if I only include the main factors in the model but not the interactions, then I no longer get the warnings.
Since I am only getting these warnings with those dependent variables that have too many zeroes, I am assuming it is due to zero-inflated data. It seems like genmod only has the option of zero-inflated data for Poisson or neg bin distributions, but not for multinomial data. I would greatly appreciate your feedback on this.
This is the code I am ussing (I also attached the data):
proc genmod data=one; by Variety; class Season Harvest Weeks; model Easyofpeeling=Season| Harvest| Weeks /type3 dist=multinomial link=cumlogit; run;
Thank you very much!
Caroline
... View more
Hello,
I have issue with my if %varexist funtion or may be with the if else condition, because it never goes into the else portion of the script.
libname dest3 spde "/.../Temp/Alain/DR";
data workingpremiumds2 ;
set dest1.workingpremiumds2 (firstobs=1 obs=5);
run;
/********************** Macro function variable exist ********************************************/
%macro varexist
/*----------------------------------------------------------------------
Check for the existence of a specified variable.
----------------------------------------------------------------------*/
(ds /* Data set name */
,var /* Variable name */);
/*----------------------------------------------------------------------
Usage Notes:
%if %varexist(&data,NAME)
%then %put input data set contains variable NAME;
The macro calls resolves to 0 when either the data set does not exist
or the variable is not in the specified data set.
----------------------------------------------------------------------*/
%local dsid rc ;
/*----------------------------------------------------------------------
Use SYSFUNC to execute OPEN, VARNUM, and CLOSE functions.
-----------------------------------------------------------------------*/
%let dsid = %sysfunc(open(&ds));
%if (&dsid) %then %do;
%if %sysfunc(varnum(&dsid,&var)) %then 1;
%else 0 ;
%let rc = %sysfunc(close(&dsid));
%end;
%else 0;
%mend varexist;
data _null_;
set workingpremiumds2;
call execute
(compbl(cat(
"libname source ", engine,' "',strip(path),'";',
'%nrstr(%if %varexist(dest3.',strip(fname),'ORGNL_SAS_DS_ROW_NBR) = 0 %then %do;
data dest3.',strip(fname),'; ORGNL_SAS_DS_ROW_NBR=_n_; set source.',strip(fname),';run;%end;%else %do;%put ','"the variable already exist";%end;)',
"libname source clear;"
)));
run;
When I empty the folder /.../Temp/Alain/DR then I run the script, it will create 5 datasets with the variable ORGNL_SAS_DS_ROW_NBR. But if I select only from data _null_; ...run; the 5 datasets already exist as well as the variable ORGNL_SAS_DS_ROW_NBR so, it should put into the log file that the variable already exits. and not recreate the 5 datasets.
But it always recreate the 5 datasets so I suspect that it never goes into the else condition.
Please provide some help.
... View more
Hi, I am sure I am missing something simple, but I have been spinning my wheels for hours on this and just don't know where to turn besides a forum. This is on SAS Enterprise guide 8.2 I am trying to create a table that will be used to make an MRL plot. Here is my code: %macro calculate_avg(threshold, data_table);
data _temp;
set &data_table(keep=Trended_Loss);
where trended_loss > &threshold;
excess = trended_loss - &threshold;
run;
proc sql noprint;
select avg(excess)
into :AAT
from _temp;
quit;
%mend calculate_avg;
data work.results;
set work.percentiles;
call execute(cats('%calculate_avg(', Percentile_threshold, ',work.Trended)'));
Mean_Excess_Loss = &AAT;
run; work.percentiles is a table is derived from work.Trended, containing the percentiles from 90 to 99.9 with a .1 step. What I am trying to do is pass the threshold based on the percentile into the macro and estimate the average above the threshold using the _temp table and the proc sql statement Since the table contains 100 different thresholds, I initially tried to make a do loop but that didn't seem to work out... If I remove noprint and comment out the Mean_Excess_loss line, I can see the results of the test at various percentiles, so the logic is sound. I just can't seem to get the value being estimated out of the macro and back into my results table. Here is the SAS log: 107 Mean_Excess_Loss = &AAT;
_
22
WARNING: Apparent symbolic reference AAT not resolved.
ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, a numeric constant, a datetime constant,
a missing value, INPUT, PUT.
108 run; Any insights you have will be extremely helpful, thank you.
... View more
Hello, Ihave an inquiry to you. I am doing the course SAS Visual Analytics 1 basics. I am doing the practise and have notice that I have missing value within the first exercise. The first image is how it should be and the second image is how it's look with me. I already tried to sorted the data items "Manager at lvl 1." (see image 2) which I get 18 observations and still does not work in the graph (see image 3). Ontbreek = missing value. The question is how can I filter these missing value out?
... View more