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.
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
Hello friends. Have a admin question please.
We are installing SAS 9.4 M8 on Linux rhel on AWS. We will have grid environment with platform suite for SAS. Do we must have to disabled selinux for forever and run environment that way? Or we can play around this selinux rules?
... View more
Hello, I produced a histogram for a single continuous variable (minimum value=0, mean=31, SD=14) using PROC SGPLOT. I included a normal density curve for the distribution, as well as a normal density curve for the same continuous variable from a standard population for comparison (lowest possible value=0, mean=43, SD=26.0). Given the lowest possible value is 0, I am not sure why the left tail of my normal curves extend past 0, and do not intersect at 0. Any insight would be very much appreciated! Thank you:)
... View more
hello, I want to find the first record: the value is 1 and lasted 24 hours, like my picture: in obs 1,the value is 1 and the record after 24h is obs 4,but between these two records is a record with AVALCN=0,so obs 1 is N; in obs 2 ,the value is 1 and the record after 24h is obs 5,but between these two records is a record with AVALCN=0,so obs 2 is N; in obs 3,AVALCN=0 ,,so obs 2 is N; in obs 4,,the value is 1 and the record after 24h is obs 6,the value between these two records is 1 ,so obs 4 is Y; in obs 5,the value is 1 ,no records were obtained after 24h,so obs 5 is N;
... View more