Kick-start Your Data Exploration Journey with SAS Information Catalog
Recent Library Articles
Recently in the SAS Community Library: @smanoj introduces you to the SAS Information Catalog, which provides a powerful search engine to find needed data assets.
Hi Everyone,
I am getting below error message when trying to run below code with ENCODING=WLATIN1 from SAS Studio. Can you please suggest on it.
Note : The same code is running fine with ENCODING=UTF-8
DATA T1; var1="aábcčdď"; run;
... View more
Dear All, I am writing a custom objective function in the PROC IML environment where I want to estimate 56 parameters. Of these, I have 51 are week fixed effects and the rest 5 are parameters of interest. I want to conduct the estimation on a dataset with 4,037,641 rows. The code below works but takes very long; no output in over 16 hours. However, for a sub-sample of 23,809 rows, the code executes in 4:45.73 real-time and 1:38.68 CPU time. I would like your suggestions on ways to optimize this code. Thank you in advance. Best, Rakesh proc iml;
/************************/
/*Read relevant variables from the data into a matrix X*/
varNames = {"seq" "position" "usage_upto" "lag_mean_usage_after_p" "credits_left" "sl_fixed_effect" "pos_fixed_effect" "max_pos" "wk" "choice_p" "chosen" "week_fe_scroll"};
use scroll;
read all var varNames into x;
close scroll;
/************************/
b = uniqueby(x[,1],1)`; /*starting points in each session*/
u = unique(x[,1]);
b = b ||(nrow(x[,1])+1); /* trick: append (n+1) to end of b for taking care of the last session*/
param = {3.354 -0.097 -2.538 0.146 0.002 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0}; /*set initial parameter values for models with CHOSEN VARIABLE*/
start LogLik(param) global(x,b);
s = j(1, ncol(b)-1,.); /*Create an empty matrix to store probability of each session*/
do i = 1 to ncol(b)-1;
idx = b[1,i]:(b[1,i+1]-1);
/*Extract unique session Ids in vector u*/
pos = x[idx,2]`;
sess_usage_upto = x[idx,3]`;
lag_use = x[idx,4]`;
sess_credits = max(x[idx,5]`);
sl_fe_scroll = max(x[idx,6]`);
sl_pos_scroll = max(x[idx,7]`);
max_pos = max(max(x[idx,8]`),3);
wk = max(x[idx,9]`);
choice_p = x[idx,10]`;
chosen = x[idx,11]`;
wk_fe_scroll = x[idx,12]`;
/************************/
/*Create a vector for transaction probability at all positions. Create the probability of observing the choice at each position (choice_mult)*/
choice_mult = (choice_p##chosen) # ((1-choice_p)##(1-chosen));
/************************/
/*Create a vector for probability of scrolling further at all positions
The seller always scrolls further from the first two positions*/
if wk = 52 then k = 0; else do; z = wk + 5; k = param[z]; end;
sc = logistic(param[1] + param[2]*pos + param[3]*(sess_usage_upto/pos) + param[4]*lag_use + param[5]*sess_credits + k);
sc[1,1] = 1; sc[1,2] = 1;
choice_mult_sc = choice_mult # sc; /*multiply choice prob and scrolling prob at each position*/
/************************/
/************************/
/*Create a vector for probability of ending at all positions greater then the maximum position
Up to the maximum position, the probability of ending is 0*/
ed = 1 - sc;
ed[1, 1:max_pos-1] = 0;
choice_mult_ed = choice_mult # ed; /*multiply choice prob and scrolling prob at each position*/
/************************/
/************************/
/*Compute the probability of a sample path for all possible end points in a session. Store each probability in a vector called LL*/
lag_prod_sc = lag(cuprod(choice_mult_sc))`;
lag_prod_sc[1,1] = 1;
LL = lag_prod_sc # choice_mult_ed;
if LL < 1/(2**500) then LL = 1/(2**500);
/************************/
s[i] = log(10*sum(LL)); /*Probability of aN OBSERVED session is the sum of all sample paths */
end;
return sum(s);
finish;
/************************/
/*Maximize sum(s)*/
optn = {1, /* 3. find max of function, and */ 2}; /* print moderate amount of output */
con = {. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ,
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .};
call nlpnra(rc, xres, "LogLik", param, optn, con);
/************************/
quit;
... View more
I am currently facing significant challenges while attempting to deploy SAS Viya on an OpenShift vSphere environment. As a newcomer to this ecosystem, I am finding it difficult to advance due to several problems that I will outline below. The most pressing issue is that the deployment status does not progress beyond BLANK STATE. [root@masterocp ~]# oc -n sas-viya get sasdeployment
NAME STATE CADENCENAME CADENCEVERSION CADENCERELEASE AGE
sas-viya lts 2023.10 7h13m Environment and Configuration To provide some context, I have not made any modifications to the standard requirements for the OpenShift installation. Consequently, my setup consists of a three nodes that works as a masters and workers. [root@masterocp ~]# oc get nodes
NAME STATUS ROLES AGE VERSION
nodo1 Ready control-plane,master,worker 9d v1.25.16+5c97f5b
nodo2 Ready control-plane,master,worker 9d v1.25.16+5c97f5b
nodo3 Ready control-plane,master,worker 9d v1.25.16+5c97f5b [root@masterocp ~]# oc adm top nodes
NAME CPU(cores) CPU% MEMORY(bytes) MEMORY%
nodo1 446m 5% 5615Mi 29%
nodo2 1149m 15% 10611Mi 56%
nodo3 1311m 17% 14231Mi 75% Problem Description Deployment Status Stuck at BLANK: The deployment status remains stuck at BLANK, indicating that the deployment process is not advancing as expected. This is a critical roadblock that prevents further progress. Logs Provide Limited Insight: The logs generated by the deployment operator do not offer much information that could help diagnose the issue. The lack of detailed error messages or warnings makes it challenging to identify the root cause of the problem. [root@masterocp ~]# kubectl logs -n sasoperator sas-deployment-operator-7865978cdd-vkk47
{"level":"info","version":1,"source":"sas-orchestration","messageKey":"sas-orchestration.command.started","messageParameters":{"name":"reconcile"},"properties":{"logger":"internal/apihelpers","caller":"apihelpers/apihelpers.go:44"},"timeStamp":"2024-06-14T14:45:52.934297+00:00","message":"The reconcile command started"}
{"level":"info","version":1,"source":"sas-orchestration","messageKey":"sas-orchestration.command.started","messageParameters":{"name":"reconcile"},"properties":{"logger":"internal/cmd/reconcile","caller":"reconcile/reconcile.go:30"},"timeStamp":"2024-06-14T14:45:52.934429+00:00","message":"The reconcile command started"}
{"level":"info","version":1,"source":"sas-orchestration","messageKey":"sas-orchestration.version.version","messageParameters":{"version":"1.109.0"},"properties":{"logger":"pkg/globalflags/version","caller":"version/version.go:56"},"timeStamp":"2024-06-14T14:45:52.934457+00:00","message":"version : 1.109.0"}
{"level":"info","version":1,"source":"sas-orchestration","messageKey":"sas-orchestration.version.buildDate","messageParameters":{"buildDate":"20231016.1697466963821"},"properties":{"logger":"pkg/globalflags/version","caller":"version/version.go:57"},"timeStamp":"2024-06-14T14:45:52.934466+00:00","message":"build date : 20231016.1697466963821"}
{"level":"info","version":1,"source":"sas-orchestration","messageKey":"sas-orchestration.version.commitHash","messageParameters":{"commitHash":"fbcd110fc8a10884e8c9778f6f79965ce78adb5f"},"properties":{"logger":"pkg/globalflags/version","caller":"version/version.go:58"},"timeStamp":"2024-06-14T14:45:52.934475+00:00","message":"commit hash : fbcd110fc8a10884e8c9778f6f79965ce78adb5f"}
{"level":"info","version":1,"source":"sas-orchestration","messageKey":"sas-orchestration.version.goVersion","messageParameters":{"goVersion":"go1.21.3 X:boringcrypto"},"properties":{"logger":"pkg/globalflags/version","caller":"version/version.go:59"},"timeStamp":"2024-06-14T14:45:52.934483+00:00","message":"go version : go1.21.3 X:boringcrypto"}
{"level":"info","version":1,"source":"sas-orchestration","messageKey":"sas-orchestration.version.goComplier","messageParameters":{"goCompiler":"gc"},"properties":{"logger":"pkg/globalflags/version","caller":"version/version.go:60"},"timeStamp":"2024-06-14T14:45:52.934490+00:00","message":"go compiler : gc"}
{"level":"info","version":1,"source":"sas-orchestration","messageKey":"sas-orchestration.version.goPlatform","messageParameters":{"goArch":"amd64","goOs":"linux"},"properties":{"logger":"pkg/globalflags/version","caller":"version/version.go:61"},"timeStamp":"2024-06-14T14:45:52.934505+00:00","message":"platform : linux/amd64"}
I0614 14:45:53.985580 1 request.go:665] Waited for 1.043389733s due to client-side throttling, not priority and fairness, request: GET:https://172.40.0.1:443/apis/cloudcredential.openshift.io/v1?timeout=32s
I0614 14:45:55.291449 1 leaderelection.go:248] attempting to acquire leader lease sasoperator/sas-deployment-operator...
I0614 14:46:11.974259 1 leaderelection.go:258] successfully acquired lease sasoperator/sas-deployment-operator I would appreciate some feedback to resolve this problem. Thanks in advance.
... View more
I want to compare the variables name A to Name B. Name a is a concatenation separated by commas of multiple names from an A file and Name B is a concatenation separated by commas of multiple name from a B file. I want to compare them so that if there are any matches between any of the non missing names within NAMEA to any of the non missing names in NAMEB it will output as a match indicated by 1. I'm wondering if an array with a do loop would somehow work. Thank you! Original File ID Name_A Name B Match_Flag 1 MILLIE,MIL MIL 1 2 BILL,BOB,, BOB,, 1 3 KYLE,, BILL,BROWN 0 4 ,, ,, 0
... View more
I am running a macro that creates two data sets, I want to output 2 datasets to the same excel worksheet. Then I want to call the macro again and add another worksheet with two datasets to the same workbook. Whenever I run this code, the second run does not add another worksheet. I am wondering what is going on. Thank you ods excel file='\path' options( sheet_interval='NONE' sheet_name="&SCHEMA"); proc report data=TABLE_DIFF_FINAL; run; proc report data=VAR_DIFF_FINAL; run; ods excel close;
... View more