Below is the sample code:
libname xlsout xlsx '.\out.xls';
data xlsout.a;
set sashelp.class;
run;
libname xlsout clear;
SAS Consultant in EY (https://github.com/sasrunner)
Oakville, ON, Canada
Certified SAS Base/Advanced Programmer
Certified Data Integration Developer for SAS
Certified Platform Administrator for SAS
Certified Visual Business Analyst for SAS
SAS Certified Associate: Programming Fundamentals Using SAS Viya
SAS Certified Specialist: Intermediate Programming Using SAS Viya
SAS Certified Viya Administration Specialist
libname xlsout xlsx '.\out.xls';
data xlsout.a;
set sashelp.class;
run;
libname xlsout clear;
data _null_;
array num0{*} _numeric_;
putlog "Initial numeric array:";
do i=1 to dim(num0);
putlog i= num0[i]=;
end;
a = 1;
b= 2;
array num1{*} _numeric_;
putlog "First numeric array:";
do i=1 to dim(num1);
putlog i= num1[i]=;
end;
c = 3;
array num2{*} _numeric_;
putlog "Second numeric array:";
do i=1 to dim(num2);
putlog i= num2[i]=;
end;
run;
Result:
Initial numeric array:
First numeric array:
i=1 i=1
i=2 a=1
i=3 b=2
Second numeric array:
i=1 i=1
i=2 a=1
i=3 b=2
i=4 c=3
proc sql;
connect to ORACLE
(DBMAX_TEXT=5000 READBUFF=32767 user=xxx password=xxx);
create table ddl as
select txt
from connection to ORACLE
(
select dbms_metadata.get_ddl('TABLE', table_name) txt
from user_tables
);
disconnect from ORACLE;
quit;
data num; infile datalines dlmstr="|" missover; length x $10; attrib y length=$10 informat=$char10.; length z $10; input x y z; put x= y= z=; * y is period while z is blank; datalines; 1|.|. ;
data _null_;
a=11;
b=2;
c=3;
array vars a b c;
/* if 1 in (a, b, c) then put "OK"; ERROR: we can not search the list of variables directly. */
if 1 in vars then put "OK";
run;
data _null_;
a='11';
b='2';
c='3';
array vars a b c;
if '1' in: vars then put "OK";
if '111' in: vars then put "OK";
run;
%macro readdir(indir=, outdsn=);
data &outdsn (keep=name infoname infoval);
rc=filename("mydir", "&indir");
did=dopen("mydir");
if did > 0 then do;
memcnt = dnum(did);
do i=1 to memcnt;
name = dread(did, i);
rc = filename("myfile", catx("/", "&indir", name));
fid = fopen("myfile");
if fid > 0 then do;
infonum=foptnum(fid);
do j=1 to infonum;
infoname=foptname(fid, j);
infoval=finfo(fid, infoname);
output;
end;
end;
else do;
msg = sysmsg();
put msg;
end;
rc = fclose(fid);
end;
end;
else do;
msg=sysmsg();
put msg;
end;
rc = dclose(did);
rc = filename("mydir");
run;
%mend;
%readdir(indir=C:\test, outdsn=out)