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
Hi guys,
suppose to have the following dataset:
data DB;
input ID :$20.Admission:date9. Discharge:date9. Diagnosis :$20.;
format Admission date9. Discharge date9.;
cards;
0001 06DEC2014 14DEC2014 VIRUS_A
0001 08NOV2020 11NOV2020 FLU
0004 14MAY2014 02JUN2014 FLU
0004 30JUN2015 15AUG2015 FLU
0004 16FEB2019 18FEB2019 VIRUS_A
0005 10AUG2019 11SEPT2019 FLU
....
;
I have to fit a time-series model to estimate the weekly number of hospitalizations for VIRUS_A. The dataset shown is just an example of the real dataset. I don't know how to set the "weekly" from the admission dates I have (I have also discharge dates). The study starts on 2014 but some patients are hospitalized after the start others at different months of the 2014. Moreover, does the week number start from the 01 January? If yes, what's happens if 01 Jan is in the middle of the week?
Apart the practical SAS programming, I also have not clear the theory behind mapping dates to weeks. It's the first time I deal with this data and questions.
Thank you in advance
... View more
Good morning.
I'm hoping some can help because I'm out of ideas.
I'm attempting to use ODS Excel to place the page number and number of pages in the footer at a right justify. I've tried the three different methods in the example below. I've done some searching and found some information but can't seem to get it to work.
I get warning messages such as:
WARNING: Apparent symbolic reference R not resolved. WARNING: Apparent symbolic reference P not resolved. WARNING: Apparent symbolic reference N not resolved.
Can anyone give me a hint as to what I may be doing wrong here?
options(sheet_interval = 'none'
sheet_name = 'Sheet Name'
frozen_headers = '2'
row_repeat = '1-2'
suppress_bylines = 'yes'
autofilter = 'all'
pages_fitwidth = '1'
pages_fitheight = '50'
/* print_footer = '&R &P & of &N'*/
/* print_footer = 'Page &P & of &N'*/
print_footer = "Page &R &P of &N"
/* print_footer = "&;LInstitutional Research and Assessment &R Page &P of &N &Z &F"*/
absolute_column_width = '12, 30, 30, 18, 10, 10, 12, 50');
... View more
I get the error: ERROR: The SAS/ACCESS Interface to ORACLE cannot be loaded. ERROR: Image SASORA found but not loadable.. Please make sure Oracle environment is set correctly. Look in the install/Config doc for additional info for your platform. Works fine interactively, but no longer when submitted as a batch file. Worked fine this morning (and for years), but then installed MS Visual Studio and Python. That seems to have changed some path variable SAS version 9.4 TS 1M6, Windows 10 Enterprise In interactive mode (where it continues to work): %sysget(TNS_ADMIN) returns the correct network location. ORACLE_HOME, LD_LIBRARY_PATH not defined as system variables. I've uninstalled Python, MS Visual Studio, and reinstalled SAS. Same errors. First time posting here. Looked at related posts, but couldn't figure it out. Much appreciate any help.
... View more
I'm just checking my understanding. From what I understand, if the following is correct:
Then is the following not correct? My responses would have been: 189.87%, 696.20% and 31.54%.
... View more