An experienced SAS programmer recently switched to SAS Viya and asked how to discover what products are available on his version of Viya. We discussed a few older SAS 9 procedures, and I showed him a new Viya-specific way to get information about his version of SAS and his licensed products.
This article discusses the getLicensedProductInfo action, which is a new way to obtain information about all licensed products in SAS Viya. In addition, it discusses what you will see if you run the following SAS 9 procedures or statements in Viya:
- The SYSVER and SYSVLONG macro variables. Did you know that there are newer macro variables that provide information about your SAS Viya version? Below, I discuss the SYSVIYAVERSION macro variable.
- The SETINIT procedure.
- The PRODUCT_STATUS procedure, which is not available in SAS Viya.
Since I am not an expert in SAS Administration, I invite comments from those who are more knowledgeable than I am.
The getLicensedProductInfo action
SAS Viya is built to work with many programming clients: SAS, Python, R, Lua, and so on. Accordingly, you can get the product information without using SAS-specific calls such as the SETINIT procedure. The getLicensedProductInfo action provides a client-agnostic way to obtain information about licensed products. You can call an action from any client language. From the SAS client, you can call actions by using PROC CAS. For example, if you want to display the products that are available in your Viya session, you can use the following statements:
cas; /* connect to CAS session */ proc cas; getLicensedProductInfo; quit;
The output will contain every product that is available in your session. There are a total of eight columns in the output table, but only the first four columns are shown.
What version of SAS are you running?
A common inquiry on discussion forums is "What version of SAS are you running?" This is important because the person asking a question might be running an old version of SAS that does not contain newer features. In SAS 9, you can use the SYSVLONG system macro variables to discover the version of SAS 9 that you are running. (The SYSVLONG and SYSVLONG4 variables are similar: SYSVLONG displays a two-digit year such as 21 whereas SYSVLONG4 displays a four-digit year such as 2021.) For example, a SAS 9 programmer might submit the following statement, which displays the version information in the log:
%put In SAS 9: &=sysvlong4;
In SAS 9, the SAS log shows the following information:
In SAS 9: SYSVLONG4=9.04.01M6P11072018
The SYSVLONG4 string tells you that the SAS release is 9.4 ("9.04") and you are running the M6 release, which was built on 07NOV2018. You might wonder what the system macro variable contains if you submit the same statement on the SAS client that comes with SAS Viya:
%put In SAS Viya: &=sysvlong4;
In SAS Viya, the SAS log shows the following information:
In SAS Viya: SYSVLONG4=V.04.00M0P02142022
The output shows that the version is "V.04" and the build date was 14FEB2022. You can interpret "V.04" as "Viya 4," which is a cloud-native version of Viya.
If you know that you are running SAS Viya, there are two additional SAS macros that provide information about your Viya release: SYSVIYARELEASE and SYSVIYAVERSION, as follows:
%put In SAS Viya: &=SYSVIYARELEASE; %put In SAS Viya: &=SYSVIYAVERSION;
The SAS log shows the following information:
In SAS Viya: SYSVIYARELEASE=20220221.1645427074741 In SAS Viya: SYSVIYAVERSION=Stable 2021.2.4
The value of SYSVIYARELEASE is a date (21FEB2022) followed by additional numbers that are related to the release. The value of SYSVIYAVERSION can be in two forms:
- Stable releases. The value before September 2022 has three levels in the form Stable YYYY.Major.Minor. For example, "Stable 2021.2.4" tells you that your version of Viya updates monthly (a "Stable" release) and that the cadence is version 6 of the 2nd release that occurred in 2021. After September 2022, the value has only two levels in the form Stable YYYY.MM. For example, "Stable 2022.09" tells you that your version of Viya is from the 9th month of 2022.
- LTS YYYY.Release. For example, "LTS 2021.2" tells you that your version of Viya updates every six months (a "long-term stable" or LTS release) and that this is the 2nd release that occurred in 2021.
SAS 9 procedures
If you are a SAS 9 programmer, you might have used two SAS procedures that provide information about your SAS release. The first procedure is PROC SETINIT, which continues to be supported in SAS Viya. The following call to PROC SETINIT shows information that is similar to the output from the getLicensedProductInfo action:
proc setinit; run;
The SAS log displays the following information:
---Base SAS Software 08MAY2022 (CPU A) ---SAS/STAT 08MAY2022 (CPU A) ---SAS/GRAPH 08MAY2022 (CPU A) ---SAS/ETS 08MAY2022 (CPU A) ---SAS/OR 08MAY2022 (CPU A) ---SAS/IML 08MAY2022 (CPU A) <--- and many other lines --->
Although PROC SETINIT continues to work, it provides less information than the getLicensedProductInfo action, so I recommend using the action instead.
A second SAS 9 procedure that some customers use is PROC PRODUCT_STATUS. In SAS 9, the output from this procedure is similar to the PROC SETINIT output, but the output also includes version information for each product. For example, the output might tell you that the SAS/STAT version is 15.2 and the SAS/GRAPH version is 9.4_M5. This method of naming versions is not used in SAS Viya, so PROC PRODUCT_STATUS is no longer supported. If you try to run the procedure in SAS Viya, the log will contain the following error message:
ERROR: Procedure PRODUCT_STATUS not found.
Using the SYSVER macro variable in SAS macro programming
One use of the SYSVER macro variable is to check the SAS version to ensure that certain language features (procedures or options) are present. For example, I have seen SAS macros that include the following logic:
/* macro logic to test whether the version of SAS is 9.4 or greater */ %if %sysevalf(&sysver < 9.4) %then %do; %put SAS 9.4 or later is required. Terminating.; %goto exit; %end;
This snippet of code will exit the macro unless the SAS version is at least 9.4 or later. What will happen if you run this macro code in SAS Viya? Thankfully, the code continues to work properly!
To understand why the logic continues to work when SYSVER contains a value such as "V.04," first recall that the %IF condition compares STRINGS, not numbers. If the SYSVER variable is V.04 (or any string that begins with "V"), the logical expression %sysevalf(&sysver < 9.4) is false. This is because the ASCII value for "V" is 86 whereas the ASCII value for "9" is 57. You can confirm this logic yourself by running the following macro statements on any version of SAS 9 or SAS Viya. In SAS 9.4M5 or later, you don't even need to embed the code inside a macro. You can run %IF-%THEN statements in open code:
/* prior to SAS 9.4M5, you need to wrap this code inside a macro call */ %if %sysevalf(V.04 < 9.4) %then %do; %put Your version of SAS is less than 9.4; /* What happens if &SYSVER resolves to V.xx? */ %end; %else %do; %put Your version of SAS is SAS 9.4 or later; %end;
This code snippet always prints "Your version of SAS is SAS 9.4 or later." Consequently, the SYSVER macro variable in SAS Viya has a value that is greater than 9.4 (or any other set of numbers).
In SAS Viya, you can use the getLicensedProductInfo action to obtain information about licensed products. Some of the older SAS 9 procedures (such as PROC SETINIT) continue to work in Viya, although others (such as PROC PRODUCT_STATUS) are deprecated. The SYSVER and SYSVLONG macro variables are supported, although in SAS Viya their values begin with "V." To discover your version of SAS Viya, use the SYSVIYAVERSION macro variable.