**********************************************************; * SAS Install detector for SAS 8 or SAS 9 *; * Purpose: to show what SAS products are installed *; * on a WINDOWS environment *; **********************************************************; * First things first--are we running on WINdows? *; %macro onlywin; %if &SYSSCP NE WIN %then %abort return; %mend; %onlywin; /* Stop here if not on WIN */ options formdlim='-' nosyntaxcheck nodmssynchk; ** get location of SAS installation: **; %let sasroot = %sysget(SASROOT); ** and one level above for 'applications' **; %let sasroo = %str(&sasroot.\..); ** get machine name: **; %let machine = %sysget(COMPUTERNAME); ** test to see if program is being run in batch **; %macro btest; %if &sysenv = FORE %then %do; dm editor 'output;clear' wedit; dm editor 'log;clear' wedit; %end; %mend btest; *%btest; %global _SASSPLEVEL; %macro checksplev(); %if &sysver < %str(9) %then %let _SASSPLEVEL = SAS &sysver; %else %do; %let hfavail = %sysfunc(tslvl(uwuhotfi)); %if (%sysfunc(index(&hfavail,TS)) gt 0) %then %let _SASSPLEVEL = %sysfunc(hotfix()); %else %let _SASSPLEVEL = SAS &sysver (&sysvlong4); %end; %mend; %checksplev; Title1 'Windows SAS Install Reporter Version 1.0'; Title3 "&_SASSPLEVEL - SITE: &SYSSITE - MACHINE: &machine - OS: &SYSSCP (&SYSSCPL)"; ***********************************************************************; * This code determines what is installed by reading the .ini files *; * that are associated with each product. It is much simpler and more *; * complete than any other method. *; ***********************************************************************; filename inis "&sasroot\core\sasinst\data\*.ini"; data components; length component $ 60; label component = 'COMPONENT ----------------------------------------'; infile inis; input; if _infile_=:'Component=' then component=scan(_infile_,2,':'); else delete; run; proc sort data=components nodupkey; by component; run; Proc print data=components noobs uniform label; title5 "SAS Institute Products or Components Installed"; run; ************************************************************************; * The following code runs if SAS is 9.1.3 and allows surfacing certain *; * custom product versions and executable build versions. *; ************************************************************************; %macro runstatus; %if "&SYSVLONG" > "9.01.01M3" %then %do; filename statlog temp; proc printto log=statlog new; run; proc product_status allinfo; run; proc printto; run; data prodstat; infile statlog firstobs=10 length=len; length component $45 custver $10 imgver $16; retain component custver imgver ' '; label component = 'COMPONENT ------------------------------------' custver = 'Custom version' imgver = 'Build version'; input; if _infile_ =: 'For ' then component = substr(_infile_,5,len-8); if _infile_ =: ' Custom' then custver = substr(_infile_,32); if _infile_ =: ' Image' and component ^=: 'PRODNUM' then do; imgver = substr(_infile_,31); output; end; run; filename statlog; Proc print data=prodstat noobs uniform label; title5 "Custom Version Information for Selected SAS Institute Products or Components"; run; %end; %mend; %runstatus; ********************************************************************; * This code checks to see what client apps are installed *; * in addition to the SAS system. Examples include SAS *; * Eminer Tree Viewer, SAS System Viewer etc. *; * However, no further analysis is done for these (hot fixes, etc.) *; ********************************************************************; filename appfile "&sasroo."; data temp2; length appname $ 40; label appname = 'COMPONENT ---------------------------'; ap=dopen('appfile'); nm=dnum(ap); do i=1 to nm; appname=dread(ap,i); if upcase(appname) not in ('SETUP LOGS', 'INSTALL') then output; end; ap=dclose(ap); keep appname; run; filename appfile; ***********************************************************; * Then we print out the SAS products and SAS components *; * that are installed *; ***********************************************************; proc print data=temp2 noobs uniform label; title5 "Possible Other SAS Insitute Applications, Solutions, or Client Components Installed"; title7 "(These are file objects in the installation path and no further analysis of them is done.)"; run; quit; ********************************************************; * This code checks to see what SAS maintenance is on *; ********************************************************; %macro checkmaint; %if %sysfunc(fileexist("&sasroot\*wn.log")) %then %do; filename hotfixes "&sasroot\*wn.log"; data hotfixes; length file $ 200; retain hotfix ' ' status 'APPLIED '; label hotfix = 'HOT FIX' status = 'APPLICATION STATUS'; infile hotfixes filename=file eov=foo end=done; input; if foo or done then do; output; status='APPLIED'; end; if _n_=1 or foo=1 then hotfix=reverse(substr(scan(reverse(file),2,'\.'),3)); if _INFILE_=:"Could Not Copy" then status='INCOMPLETE!'; foo=0; keep hotfix status; run; %end; %else %do; data hotfixes; retain hotfix '*NONE*' status ' '; label hotfix = 'HOT FIX' status = 'APPLICATION STATUS'; output; stop; run; %end; %mend; %checkmaint; proc print data=hotfixes noobs uniform label; title5 "Staus of Hot Fixes found for &_SASSPLEVEL"; run; ****************************************************************; * The following code runs if SAS is 9.1.3 and allows surfacing *; * the Java/JRE installation and version information. *; ****************************************************************; %macro javastatus; %if "&SYSVLONG" > "9.01.01M3" %then %do; %let currerr = &syserr; filename javalog temp; proc printto log=javalog new; run; proc javainfo; run; proc printto; run; %if (&currerr = 0) and (&syserr ^= 0) %then %return; /* done if PROC JAVAINFO fails */ title5 "SAS Java Environment Installation Information"; title6 " "; data _null_; infile javalog firstobs=8; file print; input; if index(_infile_,'The SAS System') then delete; if _infile_ =: 'NOTE:' then stop; put ' ' _infile_; run; filename javalog; %end; %mend; %javastatus; title; ** clear title **;