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.
Hello, I ran a linear mixed model with repeated measures using PROC MIXED. I used the RCORR statement to obtain the intraclass correlation coefficient (ICC) for the non-independent variable 'score' across readers. Is there a function within PROC MIXED that outputs the 95% CI and p-value for the ICC? PROC MIXED DATA=final COVTEST;
CLASS subject_id reader (REF='1');
MODEL score = reader / S CL;
REPEATED / SUBJECT=subject_id TYPE=cs R RCORR;
RUN; Thank you for your help!
... View more
When using function foptname and filename contains Chinese character, it failed to return value. The prerequisites are:
1. Windows OS;
2. SAS 9.4 M8;
3. UTF-8 encoded SAS session;
And the active code page of my Windows OS is 936, which means simplified Chinese, a friend think this could be related.
Using foptname and finfo to get file attributes, with English file name:
filename _dummy_ "C:\Profiles\Work\temp\hello.sas";
data _null_;
fid=fopen('_dummy_');
if fid then do;
do i=1 to foptnum(fid);
foptname=foptname(fid,i);
finfo=finfo(fid,foptname);
put foptname ":" finfo;
end;
fid=fclose(fid);
end;
run;
Log:
文件名 :C:\Profiles\Work\temp\hello.sas
RECFM :V
LRECL :32767
文件大小(字节) :634
上次修改时间 :2024年05月16日 10时06分17秒
创建时间 :2024年05月16日 10时06分17秒
The output is cool.
With Chinese file name:
filename _dummy_ "C:\Profiles\Work\temp\你好.sas";
data _null_;
fid=fopen('_dummy_');
if fid then do;
do i=1 to foptnum(fid);
foptname=foptname(fid,i);
finfo=finfo(fid,foptname);
put foptname ":" finfo;
end;
fid=fclose(fid);
end;
run;
Log:
文件名 :C:\Profiles\Work\temp\你好.sas
RECFM :V
LRECL :32767
:
:
:
Missing the last 3 output.
With Janpenese file name:
filename _dummy_ "C:\Profiles\Work\temp\こんにちは.sas";
data _null_;
fid=fopen('_dummy_');
if fid then do;
do i=1 to foptnum(fid);
foptname=foptname(fid,i);
finfo=finfo(fid,foptname);
put foptname ":" finfo;
end;
fid=fclose(fid);
end;
run;
Log:
文件名 :C:\Profiles\Work\temp\こんにちは.sas
RECFM :V
LRECL :32767
:
:
:
Missing the last 3 output.
Why I cann't get right output when filename contains MBCS? Is there a robust way to get file attributes regardless of the encoding or OS? Thanks in advance.
PS1: Under euc-cn(whichc means simplified Chinese) encoded SAS session, Windows OS, the problem just disappear.
PS2: Under utf-8 encoded SAS session, Linux OS, the problem just disappear.
... View more
I am attempting to extract topics from a collection of customer comments. I would like to be able to parse common phrases. I read the documentation for the multi term parameters within the parse statement. However I am not getting it to work. How can I pass the phrases"I don't know", "improve training" or "everything is fine"?
... View more
I have long data and wrote code to track changes in 2 variables over time. However, the second entry for each userID is wrong. My data, code, and screenshot of results below. What is wrong with the code?
data fake_data;
input userID $ event_date date9. response $ code $;
format event_date date9.;
datalines;
1693 01Dec2014 Y V
1693 01Jan2015 Y V
1693 01Feb2015 Y V
1693 01Mar2015 M G
1693 01Apr2015 M G
1693 01May2015 M G
1129 01Feb2018 Y V
1129 01Mar2018 Y V
1129 01Apr2018 N R
1129 01May2018 N R
1129 01Jun2018 M R
1129 01Jul2018 M R
1345 01Aug2016 N R
1345 01Sep2016 N R
1345 01Oct2016 N R
1345 01Nov2016 N R
1345 01Dec2016 M R
1345 01Jan2017 M G
1345 01Feb2017 Y G
1345 01Mar2017 Y G
1345 01Apr2017 Y G
1345 01May2017 Y G
;
proc sort data = fake_data out=fake_data_nodupkey nodupkey; by userID event_date; run;
data flag_vars;
set fake_data_nodupkey;
by userID event_date;
if first.userID then do;
prev_response = response;
prev_code = code;
end;
else do;
prev_response = lag(response);
prev_code = lag(code);
end;
response_change = 0;
if response ne prev_response then response_change = 1;
code_change = 0;
if code ne prev_code then code_change = 1;
run;
proc print data=flag_vars;
run;
... View more
I have an interesting challenge with TEMPLATE. I am trying to create a lattice where each plot within the lattice is a panel of graphs. For a single panel of graphs, I can easily do this with SGPANEL, but I need to make a single figure with several different panels. The following TEMPLATE code works just fine to create a 1x4 panel of graphs (instead of using SGPANEL):
proc template;
define statgraph test12;
begingraph;
layout datapanel classvars=(type _trt) / rows=1 columns=4;
layout prototype;
bandplot x=year limitupper=uclmarg limitlower=lclmarg ;
seriesplot x=year y=y / lineattrs=graphFit ;
scatterplot x=year y=y / markerattrs=(size=8px color=blue symbol=circlefilled) ;
endlayout;
endlayout;
endgraph;
end;
run;
I would like to wrap the equivalent of a "LAYOUT LATTICE" around this to have several rows, where each row is a panel of four (or whatever) graphs (with a different response variable for each row). I realize that LAYOUT LATTICE does not allow for DATAPANEL, so I am looking for a workaround. For instance, I would like to use something like:
proc template;
define statgraph test12;
begingraph;
layout lattice / columns=1 rows=3;
layout datapanel classvars=(type _trt) / rows=1 columns=4;
layout prototype;
bandplot x=year limitupper=uclmarg limitlower=lclmarg ;
seriesplot x=year y=p / lineattrs=graphFit ;
scatterplot x=year y=y / markerattrs=(size=8px color=blue symbol=circlefilled) ;
endlayout;
layout datapanel classvars=(type _trt) / rows=1 columns=4;
layout prototype;
bandplot x=year limitupper=uclmarg2 limitlower=lclmarg2 ;
seriesplot x=year y=p2 / lineattrs=graphFit ;
scatterplot x=year y=y2 / markerattrs=(size=8px color=blue symbol=circlefilled) ;
endlayout;
endlayout;
....
endlayout;
endgraph;
end;
run;
Any recommendations on how to do this? Thanks.
LVM
... View more